@smartkomm/plexus-cli 0.1.285 → 0.1.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +5 -5
- package/dist/spec.snapshot.json +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -11617,12 +11617,12 @@ The link is valid for {{gueltigkeit}} and works once. Afterwards you are signed
|
|
|
11617
11617
|
- ${i.join(`
|
|
11618
11618
|
- `)}`);return r}s(Hm,"readMappingFile");async function Nd(e,n,t,r,i){let o=[];for(let a=0;a<n.length;a+=t)try{o.push(...await i(n.slice(a,a+t)))}catch(l){let d=a===0?"":r?` The first ${a} of ${n.length} rows were written; a re-run finds them again.`:` (after ${a} of ${n.length} rows planned; nothing was written)`;throw new Error(`${e}: ${l instanceof Error?l.message:String(l)}${d}`,{cause:l})}return o}s(Nd,"sendInBatches");var s5=100,Fb="learning-groups apply",Lb=class extends N{static{s(this,"LearningGroupsApplyCommand")}file=f.String("--file",{required:!0,description:"The class list (CSV, header row, the mapping's delimiter)."});mapping=f.String("--mapping",{required:!0,description:"The mapping file (JSON): which column is code, unit, program, grade level, capacity; every other column ignored with a reason."});confirm=f.Boolean("--confirm",!1,{description:"Write (else the plan only)."});static paths=[["learning-groups","apply"]];static usage=R.Usage({category:"Master data",description:"Bring a school's classes in from a file: program, school year and learning group per row, by stable key \u2014 plan unless --confirm.",details:"Every column of the file is read by the mapping or listed in its ignoredColumns, every mapped value is listed \u2014 else the plan names each problem and nothing is sent. An existing program is reused and never renamed; a class is found again by its key (unit, school year, class code), so a re-run creates nothing.",examples:[["Plan","$0 --env staging --tenant <slug> learning-groups apply --file ./klassen.csv --mapping ./klassen.mapping.json"],["Write","$0 --env staging --tenant <slug> learning-groups apply --file ./klassen.csv --mapping ./klassen.mapping.json --confirm"]]});async execute(){let n=Hm(Fb,this.mapping,XF),t=Ym(Pd(Fb,this.file),n.delimiter,this.file),{rows:r,problems:i}=eL(t,n);if(i.length>0)throw new Error(`learning-groups apply: ${i.length} problems, nothing was sent:
|
|
11619
11619
|
- ${i.join(`
|
|
11620
|
-
- `)}`);let o=await this.caller(),a=this.requireTenant(o),l=await Nd(Fb,r,s5,this.confirm,async d=>(await o.mutation(x.learningGroupImport.apply,{client:a,dryRun:!this.confirm,schoolYear:n.schoolYear,rows:d})).rows);return this.print(a5(l,this.confirm),d=>[...d.classes.map(c=>({...c})),{class:"\u2014",program:`${d.programsCreated} new / ${d.programsTotal}`,schoolYear:`${d.runsCreated} new / ${d.runsTotal}`,action:d.totals,changes:d.mode}],["class","program","schoolYear","action","changes"]),0}};function a5(e,n){let t=s(a=>{let l=new Map;for(let[d,c]of a)l.get(d)!=="create"&&l.set(d,c);return l},"created"),r=t(e.map(a=>[a.program.key,a.program.action])),i=t(e.map(a=>[a.run.key,a.run.action])),o=s(a=>e.filter(l=>l.group.action===a).length,"count");return{mode:n?"COMMITTED":"PLAN (re-run with --confirm to write)",programsTotal:r.size,programsCreated:[...r.values()].filter(a=>a==="create").length,runsTotal:i.size,runsCreated:[...i.values()].filter(a=>a==="create").length,totals:`${o("create")} create \xB7 ${o("update")} update \xB7 ${o("unchanged")} unchanged`,classes:e.map(a=>({class:a.code,program:`${a.program.key}${a.program.action==="create"?" (new)":""}`,schoolYear:`${a.run.key}${a.run.action==="create"?" (new)":""}`,action:a.group.action,changes:a.group.changes.join("; ")}))}}s(a5,"summary");var tL=[Lb];function Mb(e){return e.trim().toLowerCase()}s(Mb,"normalizeEmail");var l5={newTaskDelayMinutes:30,reminderAfterDays:3,reminderIntervalDays:7,reminderMax:2,businessHoursOnly:!0},iL={newTaskDelayMinutes:{min:1,max:1440},reminderAfterDays:{min:1,max:30},reminderIntervalDays:{min:1,max:30},reminderMax:{min:1,max:5}},d5=Object.keys(iL),rL=Object.keys(l5);function oL(e){if(typeof e!="object"||e===null||Array.isArray(e))return["familyMail must be an object"];let n=[];for(let i of Object.keys(e))rL.includes(i)||n.push(`familyMail.${i} is not a setting (known: ${rL.join(", ")})`);let t=e;for(let i of d5){let o=t[i];if(o===void 0)continue;let{min:a,max:l}=iL[i];(typeof o!="number"||!Number.isInteger(o)||o<a||o>l)&&n.push(`familyMail.${i} must be a whole number from ${a} to ${l}`)}let r=t.businessHoursOnly;return r!==void 0&&typeof r!="boolean"&&n.push("familyMail.businessHoursOnly must be true or false"),n}s(oL,"familyMailIssues");var c5=["permanentLink","periodLink"],cEe=720*60*1e3;function sL(e){if(typeof e!="object"||e===null)return!1;let n=e;return n.mode==="oneTimeLink"&&Object.keys(n).join(",")==="mode"}s(sL,"isExternalSignIn");function aL(e){if(typeof e!="object"||e===null)return!1;let n=e.mode;return c5.includes(n)}s(aL,"namesRetiredExternalSignIn");function lL(e,n,t){let r=new Map,i=new Set,o=e;for(;o!==void 0;){i.has(o)&&F(`Role inheritance cycle at ${o}.`),n.has(o)||F(`Missing role ${o} in inheritance path.`),i.add(o);for(let a of t.get(o)??[]){let l=r.get(a.customFieldId);l&&ae("ROLE_FIELD_INHERITED",{de:`Das Feld ${a.customFieldId} ist auf dem Vererbungspfad der Rolle mehrfach zugeordnet (${l.roleId}, ${o}). Geerbte Felder lassen sich nicht \xFCberschreiben.`,en:`The field ${a.customFieldId} is assigned more than once on the role's inheritance path (${l.roleId}, ${o}). Inherited fields cannot be overridden.`}),r.set(a.customFieldId,a)}o=n.get(o)}return[...r.values()]}s(lL,"resolveRoleFields");var dL=new Set(["input","parties"]);function cL(e,n){let t=new Set(Array.from(e,Bm));for(let i of t)(!/^[a-z][a-z0-9_]*$/.test(i)||dL.has(i))&&ae("INVALID",{de:`Ung\xFCltiger oder reservierter Feldschl\xFCssel: ${i}.`,en:`Invalid or reserved field key: ${i}.`});let r=new Set;for(let i of n){let o=Bm(i);(!/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/.test(o)||dL.has(o.split(".")[0]))&&ae("INVALID",{de:`Ung\xFCltiger oder reservierter Parameterschl\xFCssel des Resolvers: ${i}.`,en:`Invalid or reserved resolver parameter key: ${i}.`}),t.has(o)&&ae("INVALID",{de:`Der Resolver-Parameter ${i} kollidiert mit einem Feldschl\xFCssel.`,en:`The resolver parameter ${i} collides with a field key.`}),r.has(o)&&ae("INVALID",{de:`Doppelter Parameterschl\xFCssel des Resolvers: ${i}.`,en:`Duplicate resolver parameter key: ${i}.`}),r.add(o)}}s(cL,"assertResolverFieldKeys");var qb=["debtor","beneficiary","service_provider"];var uL=["stammdaten","bewerbungsmanagement","finanzen_vertraege","administration","aufgaben","notifications"],u5={stammdaten:{_self:["access","read","write","configure"],parties:["read","write","delete"],customFields:["read","configure","editAutomatic"]},bewerbungsmanagement:{_self:["access"],branding:["manage"],applications:["read","manage","submitOwn","viewExternal","assignResponsibility"],forms:["configure"],workflow:["approval"],testActions:["run"]},finanzen_vertraege:{_self:["access"],contracts:["manage"],payments:["connect"]},administration:{_self:["access"],roles:["manage"],permissions:["manage"],users:["manage"],masterData:["manage"],feedback:["viewAll"],organizationStructure:["manage"],apiTokens:["manage"],config:["read","manage"]},aufgaben:{_self:["access"],items:["read","write","assign","decide"]},notifications:{_self:["access"],mail:["configure"],deliveries:["read"]}},Kb=Object.entries(u5).flatMap(([e,n])=>Object.entries(n).flatMap(([t,r])=>r.map(i=>`${e}.${t}.${i}`))),fL=["read","write","configure"];var f5={tenants:["accessAll"],workers:["monitor"],notifications:["monitor"],users:["manage"],feedback:["read","manage","tags","assign"],config:["read","manage"],schema:["read"],audit:["read","readActor"],apiTokens:["manage"],demoLinks:["manage"]};var jb=Object.entries(f5).flatMap(([e,n])=>n.map(t=>`_platform.${e}.${t}`)),p5=jb,m5=["_platform.feedback.assign","_platform.audit.readActor","_platform.apiTokens.manage"],vEe=p5.filter(e=>!m5.includes(e));function Cd(e,n){return e?.includes(n)??!1}s(Cd,"tenantHasModule");var pL=["bewerbungsmanagement.applications.submitOwn"];function mL(e){return Number.isSafeInteger(e)&&e>=1&&e<=36500}s(mL,"isRetentionDays");var REe=m.union(m.literal("persons.firstName"),m.literal("persons.lastName"),m.literal("organizations.name"));var h5={Abholberechtigt:"Authorized pickup",Abholzeitfenster:"Pickup window","Abmeldung vom Religionsunterricht seit":"Withdrawn from religion class since","5a, 7b, Vorkurs":"5a, 7b, prep course",Adresszusatz:"Address supplement",Aktiv:"Active","Allergien & Besonderheiten":"Allergies & special notes","Alle Einrichtungen":"All units",Anrede:"Salutation",Ansprechpartner:"Contact person",Arbeitsverh\u00E4ltnis:"Employment",Arbeitszeit:"Working time",Art:"Type","Art der rechtlichen Vertretung":"Legal representation type",Aufenthalt:"Residence","Aufnahme am":"Admission date",Auskunftsberechtigt:"Authorized for information","Ausweis erforderlich":"ID required",Bewerbung:"Application",Bereiche:"Areas","Bedarf an sonderp\xE4dagogischer Unterst\xFCtzung":"Special educational support needed",befreit:"Exempt","Betreuung bis":"Care until",Beziehungen:"Relationships",Daten:"Data",Deutsch:"German",Deutschland:"Germany",divers:"Diverse",Divers:"Diverse","Dokumente & Nachweise":"Documents & evidence",Eintrittsdatum:"Start date","Einwilligung f\xFCr Videoaufnahmen":"Video recording consent",Einschulung:"School enrollment","Endg\xFCltige Zuweisung liegt vor":"Final assignment confirmed","elterliche Sorge":"Parental custody","Entlassung am":"Release date",Entscheidungsbefugt:"Authorized to decide",Erg\u00E4nzungspflegschaft:"Supplementary guardianship",Erstsprache:"First language",Evangelisch:"Protestant",evangelisch:"Protestant",Ehemalig:"Alumni","E-Mail":"Email","Empfehlung Bedarf sonderpad. Unterst.":"Recommendation: special educational support","Empfehlung F\xF6rderort":"Recommendation: support location","Empfehlung F\xF6rderschwerpunkt":"Recommendation: support focus","Extern/Bewerber":"External/applicant",F\u00F6rderbedarf:"Support needs",F\u00F6rderschule:"Special school",F\u00F6rderstunden:"Support hours","F\xF6rderstunden/Woche":"Support hours/week","F\xF6rderschwerpunkte (Mehrfachauswahl)":"Support focuses (multiple selection)",Fotoerlaubnis:"Photo consent",F\u00F6rderung:"Support",Frau:"Ms.",Ganztag:"Full-day care","Ganztag aktiv":"Full-day active",Gasth\u00F6rer:"Guest student",Geburtsdatum:"Date of birth",Geburtsland:"Country of birth",Geburtsort:"Place of birth","Gemeinsames Lernen":"Inclusive learning",Geschlecht:"Gender",Gesundheit:"Health","Gesundheit & Nachweise":"Health & evidence","Getrennt lebend":"Living separately","Gutachten an Schulamt/BezReg":"Report sent to school authority/district government","Gutachten erstellt von":"Report prepared by","Gutachten-Beauftragung bis":"Report commissioned until",Herr:"Mr.",Hinweis:"Note",Hinweise:"Notes","in Kl\xE4rung":"Clarifying","In Pr\xFCfung":"Under review","in Pr\xFCfung":"Under review",Islamisch:"Islamic",islamisch:"Islamic",Ja:"Yes","Ja \u2014 \xA74 Abs. 1 S. 1":"Yes \u2014 Section 4 (1) sentence 1",Katholisch:"Catholic",katholisch:"Catholic",Keine:"None","Keine Auskunft an Dritte":"No information to third parties","keine Teilnahme":"No participation","kein Bedarf":"No need",Klasse:"Class","Klassenlehrer/in":"Class teacher",Konfession:"Denomination",Kontaktarten:"Contact types",Korrespondenz:"Correspondence","K\xF6rperliche und motorische Entwicklung":"Physical and motor development",Land:"Country",Lernen:"Learning","LRS / Rechenschw\xE4che":"Dyslexia / dyscalculia",m\u00E4nnlich:"male",Masernimpfnachweis:"Measles vaccination proof","Mit Einschr\xE4nkungen":"With restrictions","Mitarbeiter/in":"Staff member",Mutter:"Mother",Nachname:"Last name","Name der Organisation":"Organization name",Nein:"No","Nicht gruppiert":"Ungrouped",Notfallkontakt:"Emergency contact","Nr.":"No.","Ohne Angabe":"Not specified","ohne Angabe":"not specified","Operative Kontaktart":"Operational contact type","Operativer Kontakt":"Operational contact",Organisation:"Organization",Organisationen:"Organizations",Ort:"City",Ortsteil:"District",Person:"Person",PLZ:"Postal code",Polen:"Poland",Position:"Position",Prim\u00E4rkontakt:"Primary contact",Priorit\u00E4t:"Priority","Probeweise Zuweisung liegt vor bis":"Trial assignment confirmed until",Regelschule:"Mainstream school","Rechtliche Vertretung":"Legal representation",Religionsunterricht:"Religion class",Rolle:"Role",Schule:"School",Schulinformationen:"School information","Sch\xFCler/in":"Student","Sch\xFClerinteressent/in":"Prospective student",Sch\u00FClernummer:"Student number",Sch\u00FClerstatus:"Student status","Sch\xFClerverzeichnis Nr.":"Student directory no.",Schwimmunterricht:"Swimming class","Scope der rechtlichen Vertretung":"Legal representation scope",Sprache:"Language",Staatsangeh\u00F6rigkeit:"Nationality",Stammdaten:"Master data",Standort:"Location","Standort/Schule":"Location/school",Status:"Status",Stra\u00DFe:"Street",Syrien:"Syria",Telefon:"Phone",Teilnahme:"Participation",T\u00FCrkei:"Turkey",T\u00FCrkisch:"Turkish",Ukraine:"Ukraine",Umfang:"Extent","Umfang der rechtlichen Vertretung":"Legal representation extent",Verwaltung:"Administration",Verwandtschaft:"Kinship",Verwandtschaftsart:"Kinship type",Verwandtschaftsgrad:"Degree of kinship",Vater:"Father",Vietnamesisch:"Vietnamese",Vollst\u00E4ndig:"Complete",voll:"full",Vorname:"First name","Vormundschaft Amt":"Public guardianship","Vormundschaft Einzelner":"Individual guardianship","Vormundschaft Verein":"Association guardianship",weiblich:"female",Wohnadresse:"Residential address",Wohnort:"City of residence","Aktives Programm \xFCber Einschreibung, Lerngruppe und Programm.":"Active program across enrollment, learning group, and program.",Arabisch:"Arabic","Auskunft gesperrt":"Information blocked","Campus Lindenfeld":"Campus Lindenfeld","Campus Sonnhalde":"Campus Sonnhalde","Emotionale Entwicklung":"Emotional development","Emotionale und soziale Entwicklung":"Emotional and social development","Foto eingeschr\xE4nkt":"Photo restricted","Geistige Entwicklung":"Cognitive development",Gro\u00DFeltern:"Grandparents","Grundschule Sonnenberg":"Sonnenberg Elementary School","Interessent/in":"Prospect","Keine Einwilligung f\xFCr Videoaufnahmen":"No video recording consent","Keine Fotos":"No photos","K\xF6rper/Motorik":"Physical/motor",Lehrer:"Teacher",Mitarbeitende:"Staff","Moers, Krefeld":"Moers, Krefeld","Namen der verkn\xFCpften rechtlichen Vertretungen.":"Names of the linked legal representatives.",Pflegeperson:"Caregiver",Programm:"Program","Rechtliche Vertretungen":"Legal representatives",Schulleitung:"School leadership",Schulverwaltung:"School administration",Stiefeltern:"Stepparents",Verm\u00F6gen:"Assets",teilweise:"partial"};function ds(e,n=h5[e]){return(n===void 0||n.trim()==="")&&F(`label("${e}"): no English text \u2014 pass it, or add it to ENGLISH_LABELS`),{de:e.trim(),en:n.trim()}}s(ds,"label");var Vb=[{key:"first_name",label:ds("Vorname","First name"),type:"string",systemColumn:"persons.firstName",partyKind:"person",required:!0},{key:"last_name",label:ds("Nachname","Last name"),type:"string",systemColumn:"persons.lastName",partyKind:"person",required:!0},{key:"organization_name",label:ds("Name der Organisation","Organization name"),type:"string",systemColumn:"organizations.name",partyKind:"organization",required:!0}],g5=new Map(Vb.map(e=>[e.key,e]));function hL(e){return g5.has(e)}s(hL,"isSystemFieldKey");var Bb={string:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},textarea:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},email:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},tel:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},date:{dataType:"date",valueColumn:"valueDate",fieldMapTarget:!0},number:{dataType:"number",valueColumn:"valueNumber",fieldMapTarget:!0},boolean:{dataType:"boolean",valueColumn:"valueBoolean",fieldMapTarget:!0},files:{dataType:"file",valueColumn:"valueJson",fieldMapTarget:!0},"auto-string":{dataType:"text",valueColumn:"valueString",fieldMapTarget:!1},"0-1-select":{dataType:"option",valueColumn:"valueString",fieldMapTarget:!0},"0-n-select":{dataType:"option",valueColumn:"valueJson",fieldMapTarget:!0},object:{dataType:"composite",valueColumn:"valueJson",fieldMapTarget:!0},relationship:{dataType:"edge",valueColumn:"valueJson",fieldMapTarget:!1},"program-interest":{dataType:"edge",valueColumn:"valueJson",fieldMapTarget:!1}};var jEe=11*6e4;var VEe=30*6e4;var BEe=5*6e4;var UEe=5*6e4;var Jm="tenant",GEe=m.record(m.string(),m.string());var uo=1024*1024,Dd=["application/pdf","image/jpeg","image/png","image/webp"];var Qm=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","application/vnd.oasis.opendocument.text","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","image/jpeg","image/png"],gL={docRef:{maxBytes:25*uo,allowedMime:Dd},partyFile:{maxBytes:25*uo,allowedMime:Dd},import:{maxBytes:500*uo,allowedMime:null},signedContract:{maxBytes:25*uo,allowedMime:Dd},artifactVersion:{maxBytes:25*uo,allowedMime:Dd},chatAttachment:{maxBytes:25*uo,allowedMime:Dd},tenantFile:{maxBytes:20*uo,allowedMime:Qm},documentTemplate:{maxBytes:25*uo,allowedMime:null}};function yL(e){let n=atob(e),t="";for(let r=0;r<n.length;r++)t+=n.charCodeAt(r).toString(16).padStart(2,"0");return t}s(yL,"sha256Base64ToHex");var Gt={filename:m.string(),mimeType:m.string(),sizeBytes:m.number(),sha256:m.string()},y5=m.object({storageId:m.id("_storage"),filename:Gt.filename,mimeType:Gt.mimeType,sizeBytes:Gt.sizeBytes,sha256:m.optional(Gt.sha256)}),eTe=m.object({storageId:y5.fields.storageId,filename:Gt.filename,mimeType:m.optional(Gt.mimeType),sizeBytes:m.optional(Gt.sizeBytes),sha256:m.optional(Gt.sha256),url:m.union(m.string(),m.null())});async function w5(e,n){let t=await e.db.system.get("_storage",n);return t===null?null:{...t.contentType===void 0?{}:{mimeType:t.contentType},sizeBytes:t.size,sha256:yL(t.sha256)}}s(w5,"storedObjectMeta");async function Ub(e,n){let t=(await w5(e,n))?.mimeType;return t===void 0?{}:{mimeType:t}}s(Ub,"objectType");var sTe=m.union(m.literal("de"),m.literal("en")),aTe=m.record(m.string(),m.string()),$i=m.object({de:m.string(),en:m.string()}),lTe=m.object({value:m.string(),label:$i,countryCode:m.optional(m.union(m.string(),m.null()))}),dTe=m.object({title:$i,body:$i,confirmLabel:$i}),cTe=m.union(m.string(),$i);function Zm(e){return Be.includes(e)}s(Zm,"isSupportedLocale");var k5=m.object({street:m.string(),hausnr:m.string(),plz:m.string(),ort:m.string(),land:m.string()}),wL=m.object({storageId:m.string(),filename:Gt.filename,mimeType:m.optional(Gt.mimeType),sizeBytes:m.optional(Gt.sizeBytes),sha256:m.optional(Gt.sha256),uploadedAt:m.number()}),uTe=m.union(m.string(),m.number(),m.boolean(),m.null(),k5,wL,m.array(m.string()),m.array(wL)),fTe=m.record(m.string(),m.string());var Gb=["Bewerbung","Anmeldung"];var bL=m.object({application:m.optional(m.union(...Gb.map(e=>m.literal(e))))}),gTe=m.object({application:m.union(...Gb.map(e=>m.literal(e)))}),kL={application:Gb};function zb(e,n="tenant.terms"){if(e===null||typeof e!="object"||Array.isArray(e))return[`[terms/shape] ${n} muss ein Objekt sein, z. B. { "application": "Anmeldung" }.`];let t=[];for(let[r,i]of Object.entries(e)){let o=kL[r];if(o===void 0){t.push(`[terms/unknownTerm] ${n}.${r} gibt es nicht. Einstellbar: ${Object.keys(kL).join(", ")}.`);continue}(typeof i!="string"||!o.includes(i))&&t.push(`[terms/unknownChoice] ${n}.${r} = ${JSON.stringify(i)} ist keine Wahl. M\xF6glich: ${o.join(", ")}.`)}return t}s(zb,"termsFindings");var ii="recipientName",Wa="Name der Empf\xE4ngerin oder des Empf\xE4ngers";var Fd={de:{greeting:`Hallo {{${ii}}},`,closing:`Viele Gr\xFC\xDFe
|
|
11620
|
+
- `)}`);let o=await this.caller(),a=this.requireTenant(o),l=await Nd(Fb,r,s5,this.confirm,async d=>(await o.mutation(x.learningGroupImport.apply,{client:a,dryRun:!this.confirm,schoolYear:n.schoolYear,rows:d})).rows);return this.print(a5(l,this.confirm),d=>[...d.classes.map(c=>({...c})),{class:"\u2014",program:`${d.programsCreated} new / ${d.programsTotal}`,schoolYear:`${d.runsCreated} new / ${d.runsTotal}`,action:d.totals,changes:d.mode}],["class","program","schoolYear","action","changes"]),0}};function a5(e,n){let t=s(a=>{let l=new Map;for(let[d,c]of a)l.get(d)!=="create"&&l.set(d,c);return l},"created"),r=t(e.map(a=>[a.program.key,a.program.action])),i=t(e.map(a=>[a.run.key,a.run.action])),o=s(a=>e.filter(l=>l.group.action===a).length,"count");return{mode:n?"COMMITTED":"PLAN (re-run with --confirm to write)",programsTotal:r.size,programsCreated:[...r.values()].filter(a=>a==="create").length,runsTotal:i.size,runsCreated:[...i.values()].filter(a=>a==="create").length,totals:`${o("create")} create \xB7 ${o("update")} update \xB7 ${o("unchanged")} unchanged`,classes:e.map(a=>({class:a.code,program:`${a.program.key}${a.program.action==="create"?" (new)":""}`,schoolYear:`${a.run.key}${a.run.action==="create"?" (new)":""}`,action:a.group.action,changes:a.group.changes.join("; ")}))}}s(a5,"summary");var tL=[Lb];function Mb(e){return e.trim().toLowerCase()}s(Mb,"normalizeEmail");var l5={newTaskDelayMinutes:30,reminderAfterDays:3,reminderIntervalDays:7,reminderMax:2,businessHoursOnly:!0},iL={newTaskDelayMinutes:{min:1,max:1440},reminderAfterDays:{min:1,max:30},reminderIntervalDays:{min:1,max:30},reminderMax:{min:1,max:5}},d5=Object.keys(iL),rL=Object.keys(l5);function oL(e){if(typeof e!="object"||e===null||Array.isArray(e))return["familyMail must be an object"];let n=[];for(let i of Object.keys(e))rL.includes(i)||n.push(`familyMail.${i} is not a setting (known: ${rL.join(", ")})`);let t=e;for(let i of d5){let o=t[i];if(o===void 0)continue;let{min:a,max:l}=iL[i];(typeof o!="number"||!Number.isInteger(o)||o<a||o>l)&&n.push(`familyMail.${i} must be a whole number from ${a} to ${l}`)}let r=t.businessHoursOnly;return r!==void 0&&typeof r!="boolean"&&n.push("familyMail.businessHoursOnly must be true or false"),n}s(oL,"familyMailIssues");var c5=["permanentLink","periodLink"],cEe=720*60*1e3;function sL(e){if(typeof e!="object"||e===null)return!1;let n=e;return n.mode==="oneTimeLink"&&Object.keys(n).join(",")==="mode"}s(sL,"isExternalSignIn");function aL(e){if(typeof e!="object"||e===null)return!1;let n=e.mode;return c5.includes(n)}s(aL,"namesRetiredExternalSignIn");function lL(e,n,t){let r=new Map,i=new Set,o=e;for(;o!==void 0;){i.has(o)&&F(`Role inheritance cycle at ${o}.`),n.has(o)||F(`Missing role ${o} in inheritance path.`),i.add(o);for(let a of t.get(o)??[]){let l=r.get(a.customFieldId);l&&ae("ROLE_FIELD_INHERITED",{de:`Das Feld ${a.customFieldId} ist auf dem Vererbungspfad der Rolle mehrfach zugeordnet (${l.roleId}, ${o}). Geerbte Felder lassen sich nicht \xFCberschreiben.`,en:`The field ${a.customFieldId} is assigned more than once on the role's inheritance path (${l.roleId}, ${o}). Inherited fields cannot be overridden.`}),r.set(a.customFieldId,a)}o=n.get(o)}return[...r.values()]}s(lL,"resolveRoleFields");var dL=new Set(["input","parties"]);function cL(e,n){let t=new Set(Array.from(e,Bm));for(let i of t)(!/^[a-z][a-z0-9_]*$/.test(i)||dL.has(i))&&ae("INVALID",{de:`Ung\xFCltiger oder reservierter Feldschl\xFCssel: ${i}.`,en:`Invalid or reserved field key: ${i}.`});let r=new Set;for(let i of n){let o=Bm(i);(!/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/.test(o)||dL.has(o.split(".")[0]))&&ae("INVALID",{de:`Ung\xFCltiger oder reservierter Parameterschl\xFCssel des Resolvers: ${i}.`,en:`Invalid or reserved resolver parameter key: ${i}.`}),t.has(o)&&ae("INVALID",{de:`Der Resolver-Parameter ${i} kollidiert mit einem Feldschl\xFCssel.`,en:`The resolver parameter ${i} collides with a field key.`}),r.has(o)&&ae("INVALID",{de:`Doppelter Parameterschl\xFCssel des Resolvers: ${i}.`,en:`Duplicate resolver parameter key: ${i}.`}),r.add(o)}}s(cL,"assertResolverFieldKeys");var qb=["debtor","beneficiary","service_provider"];var uL=["stammdaten","bewerbungsmanagement","finanzen_vertraege","administration","aufgaben","notifications"],u5={stammdaten:{_self:["access","read","write","configure"],parties:["read","write","delete"],customFields:["read","configure","editAutomatic"]},bewerbungsmanagement:{_self:["access"],branding:["manage"],applications:["read","manage","submitOwn","viewExternal","assignResponsibility"],forms:["configure"],workflow:["approval"],testActions:["run"]},finanzen_vertraege:{_self:["access"],contracts:["manage"],payments:["connect"]},administration:{_self:["access"],roles:["manage"],permissions:["manage"],users:["manage"],masterData:["manage"],feedback:["viewAll"],organizationStructure:["manage"],apiTokens:["manage"],config:["read","manage"]},aufgaben:{_self:["access"],items:["read","write","assign","decide"]},notifications:{_self:["access"],mail:["configure"],deliveries:["read"]}},Kb=Object.entries(u5).flatMap(([e,n])=>Object.entries(n).flatMap(([t,r])=>r.map(i=>`${e}.${t}.${i}`))),fL=["read","write","configure"];var f5={tenants:["accessAll"],workers:["monitor"],notifications:["monitor"],users:["manage"],feedback:["read","manage","tags","assign"],config:["read","manage"],schema:["read"],audit:["read","readActor"],apiTokens:["manage"],demoLinks:["manage"]};var jb=Object.entries(f5).flatMap(([e,n])=>n.map(t=>`_platform.${e}.${t}`)),p5=jb,m5=["_platform.feedback.assign","_platform.audit.readActor","_platform.apiTokens.manage"],vEe=p5.filter(e=>!m5.includes(e));function Cd(e,n){return e?.includes(n)??!1}s(Cd,"tenantHasModule");var pL=["bewerbungsmanagement.applications.submitOwn"];function mL(e){return Number.isSafeInteger(e)&&e>=1&&e<=36500}s(mL,"isRetentionDays");var REe=m.union(m.literal("persons.firstName"),m.literal("persons.lastName"),m.literal("organizations.name"));var h5={Abholberechtigt:"Authorized pickup",Abholzeitfenster:"Pickup window","Abmeldung vom Religionsunterricht seit":"Withdrawn from religion class since","5a, 7b, Vorkurs":"5a, 7b, prep course",Adresszusatz:"Address supplement",Aktiv:"Active","Allergien & Besonderheiten":"Allergies & special notes","Alle Einrichtungen":"All units",Anrede:"Salutation",Ansprechpartner:"Contact person",Arbeitsverh\u00E4ltnis:"Employment",Arbeitszeit:"Working time",Art:"Type","Art der rechtlichen Vertretung":"Legal representation type",Aufenthalt:"Residence","Aufnahme am":"Admission date",Auskunftsberechtigt:"Authorized for information","Ausweis erforderlich":"ID required",Bewerbung:"Application",Bereiche:"Areas","Bedarf an sonderp\xE4dagogischer Unterst\xFCtzung":"Special educational support needed",befreit:"Exempt","Betreuung bis":"Care until",Beziehungen:"Relationships",Daten:"Data",Deutsch:"German",Deutschland:"Germany",divers:"Diverse",Divers:"Diverse","Dokumente & Nachweise":"Documents & evidence",Eintrittsdatum:"Start date","Einwilligung f\xFCr Videoaufnahmen":"Video recording consent",Einschulung:"School enrollment","Endg\xFCltige Zuweisung liegt vor":"Final assignment confirmed","elterliche Sorge":"Parental custody","Entlassung am":"Release date",Entscheidungsbefugt:"Authorized to decide",Erg\u00E4nzungspflegschaft:"Supplementary guardianship",Erstsprache:"First language",Evangelisch:"Protestant",evangelisch:"Protestant",Ehemalig:"Alumni","E-Mail":"Email","Empfehlung Bedarf sonderpad. Unterst.":"Recommendation: special educational support","Empfehlung F\xF6rderort":"Recommendation: support location","Empfehlung F\xF6rderschwerpunkt":"Recommendation: support focus","Extern/Bewerber":"External/applicant",F\u00F6rderbedarf:"Support needs",F\u00F6rderschule:"Special school",F\u00F6rderstunden:"Support hours","F\xF6rderstunden/Woche":"Support hours/week","F\xF6rderschwerpunkte (Mehrfachauswahl)":"Support focuses (multiple selection)",Fotoerlaubnis:"Photo consent",F\u00F6rderung:"Support",Frau:"Ms.",Ganztag:"Full-day care","Ganztag aktiv":"Full-day active",Gasth\u00F6rer:"Guest student",Geburtsdatum:"Date of birth",Geburtsland:"Country of birth",Geburtsort:"Place of birth","Gemeinsames Lernen":"Inclusive learning",Geschlecht:"Gender",Gesundheit:"Health","Gesundheit & Nachweise":"Health & evidence","Getrennt lebend":"Living separately","Gutachten an Schulamt/BezReg":"Report sent to school authority/district government","Gutachten erstellt von":"Report prepared by","Gutachten-Beauftragung bis":"Report commissioned until",Herr:"Mr.",Hinweis:"Note",Hinweise:"Notes","in Kl\xE4rung":"Clarifying","In Pr\xFCfung":"Under review","in Pr\xFCfung":"Under review",Islamisch:"Islamic",islamisch:"Islamic",Ja:"Yes","Ja \u2014 \xA74 Abs. 1 S. 1":"Yes \u2014 Section 4 (1) sentence 1",Katholisch:"Catholic",katholisch:"Catholic",Keine:"None","Keine Auskunft an Dritte":"No information to third parties","keine Teilnahme":"No participation","kein Bedarf":"No need",Klasse:"Class","Klassenlehrer/in":"Class teacher",Konfession:"Denomination",Kontaktarten:"Contact types",Korrespondenz:"Correspondence","K\xF6rperliche und motorische Entwicklung":"Physical and motor development",Land:"Country",Lernen:"Learning","LRS / Rechenschw\xE4che":"Dyslexia / dyscalculia",m\u00E4nnlich:"male",Masernimpfnachweis:"Measles vaccination proof","Mit Einschr\xE4nkungen":"With restrictions","Mitarbeiter/in":"Staff member",Mutter:"Mother",Nachname:"Last name","Name der Organisation":"Organization name",Nein:"No","Nicht gruppiert":"Ungrouped",Notfallkontakt:"Emergency contact","Nr.":"No.","Ohne Angabe":"Not specified","ohne Angabe":"not specified","Operative Kontaktart":"Operational contact type","Operativer Kontakt":"Operational contact",Organisation:"Organization",Organisationen:"Organizations",Ort:"City",Ortsteil:"District",Person:"Person",PLZ:"Postal code",Polen:"Poland",Position:"Position",Prim\u00E4rkontakt:"Primary contact",Priorit\u00E4t:"Priority","Probeweise Zuweisung liegt vor bis":"Trial assignment confirmed until",Regelschule:"Mainstream school","Rechtliche Vertretung":"Legal representation",Religionsunterricht:"Religion class",Rolle:"Role",Schule:"School",Schulinformationen:"School information","Sch\xFCler/in":"Student","Sch\xFClerinteressent/in":"Prospective student",Sch\u00FClernummer:"Student number",Sch\u00FClerstatus:"Student status","Sch\xFClerverzeichnis Nr.":"Student directory no.",Schwimmunterricht:"Swimming class","Scope der rechtlichen Vertretung":"Legal representation scope",Sprache:"Language",Staatsangeh\u00F6rigkeit:"Nationality",Stammdaten:"Master data",Standort:"Location","Standort/Schule":"Location/school",Status:"Status",Stra\u00DFe:"Street",Syrien:"Syria",Telefon:"Phone",Teilnahme:"Participation",T\u00FCrkei:"Turkey",T\u00FCrkisch:"Turkish",Ukraine:"Ukraine",Umfang:"Extent","Umfang der rechtlichen Vertretung":"Legal representation extent",Verwaltung:"Administration",Verwandtschaft:"Kinship",Verwandtschaftsart:"Kinship type",Verwandtschaftsgrad:"Degree of kinship",Vater:"Father",Vietnamesisch:"Vietnamese",Vollst\u00E4ndig:"Complete",voll:"full",Vorname:"First name","Vormundschaft Amt":"Public guardianship","Vormundschaft Einzelner":"Individual guardianship","Vormundschaft Verein":"Association guardianship",weiblich:"female",Wohnadresse:"Residential address",Wohnort:"City of residence","Aktives Programm \xFCber Einschreibung, Lerngruppe und Programm.":"Active program across enrollment, learning group, and program.",Arabisch:"Arabic","Auskunft gesperrt":"Information blocked","Campus Lindenfeld":"Campus Lindenfeld","Campus Sonnhalde":"Campus Sonnhalde","Emotionale Entwicklung":"Emotional development","Emotionale und soziale Entwicklung":"Emotional and social development","Foto eingeschr\xE4nkt":"Photo restricted","Geistige Entwicklung":"Cognitive development",Gro\u00DFeltern:"Grandparents","Grundschule Sonnenberg":"Sonnenberg Elementary School","Interessent/in":"Prospect","Keine Einwilligung f\xFCr Videoaufnahmen":"No video recording consent","Keine Fotos":"No photos","K\xF6rper/Motorik":"Physical/motor",Lehrer:"Teacher",Mitarbeitende:"Staff","Moers, Krefeld":"Moers, Krefeld","Namen der verkn\xFCpften rechtlichen Vertretungen.":"Names of the linked legal representatives.",Pflegeperson:"Caregiver",Programm:"Program","Rechtliche Vertretungen":"Legal representatives",Schulleitung:"School leadership",Schulverwaltung:"School administration",Stiefeltern:"Stepparents",Verm\u00F6gen:"Assets",teilweise:"partial"};function ds(e,n=h5[e]){return(n===void 0||n.trim()==="")&&F(`label("${e}"): no English text \u2014 pass it, or add it to ENGLISH_LABELS`),{de:e.trim(),en:n.trim()}}s(ds,"label");var Vb=[{key:"first_name",label:ds("Vorname","First name"),type:"string",systemColumn:"persons.firstName",partyKind:"person",required:!0},{key:"last_name",label:ds("Nachname","Last name"),type:"string",systemColumn:"persons.lastName",partyKind:"person",required:!0},{key:"organization_name",label:ds("Name der Organisation","Organization name"),type:"string",systemColumn:"organizations.name",partyKind:"organization",required:!0}],g5=new Map(Vb.map(e=>[e.key,e]));function hL(e){return g5.has(e)}s(hL,"isSystemFieldKey");var Bb={string:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},textarea:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},email:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},tel:{dataType:"text",valueColumn:"valueString",fieldMapTarget:!0},date:{dataType:"date",valueColumn:"valueDate",fieldMapTarget:!0},number:{dataType:"number",valueColumn:"valueNumber",fieldMapTarget:!0},boolean:{dataType:"boolean",valueColumn:"valueBoolean",fieldMapTarget:!0},files:{dataType:"file",valueColumn:"valueJson",fieldMapTarget:!0},"auto-string":{dataType:"text",valueColumn:"valueString",fieldMapTarget:!1},"0-1-select":{dataType:"option",valueColumn:"valueString",fieldMapTarget:!0},"0-n-select":{dataType:"option",valueColumn:"valueJson",fieldMapTarget:!0},object:{dataType:"composite",valueColumn:"valueJson",fieldMapTarget:!0},relationship:{dataType:"edge",valueColumn:"valueJson",fieldMapTarget:!1},"program-interest":{dataType:"edge",valueColumn:"valueJson",fieldMapTarget:!1}};var KEe=11*6e4;var jEe=30*6e4;var VEe=5*6e4;var Jm="tenant",BEe=m.record(m.string(),m.string());var uo=1024*1024,Dd=["application/pdf","image/jpeg","image/png","image/webp"];var Qm=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","application/vnd.oasis.opendocument.text","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","image/jpeg","image/png"],gL={docRef:{maxBytes:25*uo,allowedMime:Dd},partyFile:{maxBytes:25*uo,allowedMime:Dd},import:{maxBytes:500*uo,allowedMime:null},signedContract:{maxBytes:25*uo,allowedMime:Dd},artifactVersion:{maxBytes:25*uo,allowedMime:Dd},chatAttachment:{maxBytes:25*uo,allowedMime:Dd},tenantFile:{maxBytes:20*uo,allowedMime:Qm},documentTemplate:{maxBytes:25*uo,allowedMime:null}};function yL(e){let n=atob(e),t="";for(let r=0;r<n.length;r++)t+=n.charCodeAt(r).toString(16).padStart(2,"0");return t}s(yL,"sha256Base64ToHex");var Gt={filename:m.string(),mimeType:m.string(),sizeBytes:m.number(),sha256:m.string()},y5=m.object({storageId:m.id("_storage"),filename:Gt.filename,mimeType:Gt.mimeType,sizeBytes:Gt.sizeBytes,sha256:m.optional(Gt.sha256)}),QEe=m.object({storageId:y5.fields.storageId,filename:Gt.filename,mimeType:m.optional(Gt.mimeType),sizeBytes:m.optional(Gt.sizeBytes),sha256:m.optional(Gt.sha256),url:m.union(m.string(),m.null())});async function w5(e,n){let t=await e.db.system.get("_storage",n);return t===null?null:{...t.contentType===void 0?{}:{mimeType:t.contentType},sizeBytes:t.size,sha256:yL(t.sha256)}}s(w5,"storedObjectMeta");async function Ub(e,n){let t=(await w5(e,n))?.mimeType;return t===void 0?{}:{mimeType:t}}s(Ub,"objectType");var rTe=m.union(m.literal("de"),m.literal("en")),iTe=m.record(m.string(),m.string()),$i=m.object({de:m.string(),en:m.string()}),oTe=m.object({value:m.string(),label:$i,countryCode:m.optional(m.union(m.string(),m.null()))}),sTe=m.object({title:$i,body:$i,confirmLabel:$i}),aTe=m.union(m.string(),$i);function Zm(e){return Be.includes(e)}s(Zm,"isSupportedLocale");var k5=m.object({street:m.string(),hausnr:m.string(),plz:m.string(),ort:m.string(),land:m.string()}),wL=m.object({storageId:m.string(),filename:Gt.filename,mimeType:m.optional(Gt.mimeType),sizeBytes:m.optional(Gt.sizeBytes),sha256:m.optional(Gt.sha256),uploadedAt:m.number()}),lTe=m.union(m.string(),m.number(),m.boolean(),m.null(),k5,wL,m.array(m.string()),m.array(wL)),dTe=m.record(m.string(),m.string());var Gb=["Bewerbung","Anmeldung"];var bL=m.object({application:m.optional(m.union(...Gb.map(e=>m.literal(e))))}),pTe=m.object({application:m.union(...Gb.map(e=>m.literal(e)))}),kL={application:Gb};function zb(e,n="tenant.terms"){if(e===null||typeof e!="object"||Array.isArray(e))return[`[terms/shape] ${n} muss ein Objekt sein, z. B. { "application": "Anmeldung" }.`];let t=[];for(let[r,i]of Object.entries(e)){let o=kL[r];if(o===void 0){t.push(`[terms/unknownTerm] ${n}.${r} gibt es nicht. Einstellbar: ${Object.keys(kL).join(", ")}.`);continue}(typeof i!="string"||!o.includes(i))&&t.push(`[terms/unknownChoice] ${n}.${r} = ${JSON.stringify(i)} ist keine Wahl. M\xF6glich: ${o.join(", ")}.`)}return t}s(zb,"termsFindings");var ii="recipientName",Wa="Name der Empf\xE4ngerin oder des Empf\xE4ngers";var Fd={de:{greeting:`Hallo {{${ii}}},`,closing:`Viele Gr\xFC\xDFe
|
|
11621
11621
|
Ihr Aufnahme-Team`,noReplyNote:"Diese E-Mail wurde automatisch versandt. Bitte antworten Sie nicht auf diese Nachricht."},en:{greeting:`Hello {{${ii}}},`,closing:`Kind regards
|
|
11622
11622
|
The admissions team`,noReplyNote:"This e-mail was sent automatically. Please do not reply to it."}},b5={de:{...Fd.de,closing:`Viele Gr\xFC\xDFe
|
|
11623
11623
|
Ihr Plexus-Team`},en:{...Fd.en,closing:`Kind regards
|
|
11624
11624
|
The Plexus team`}},v5={de:{...Fd.de,closing:null},en:{...Fd.en,closing:null}};var x5=/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g,cs=2e3;function Xm(e){let n=[];for(let t of e.matchAll(x5)){let r=t[1];n.includes(r)||n.push(r)}return n}s(Xm,"placeholdersIn");function vL(e){return e.slots??[]}s(vL,"slotsOf");function S5(e){return e.bodyVariants!==void 0?e.bodyVariants:[vL(e).filter(n=>n.key!==sd).map(n=>n.key)]}s(S5,"bodyVariantsOf");var A5=/:\/\/|www\.|mailto:/i;function E5(e,n){let t=`{{${n}}}`,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)return!1;let o=i===0?"":e[i-1],a=e[i+t.length]??"";if(o!==""&&!/\s/.test(o)||a!==""&&!/[\s.,;:!?)]/.test(a))return!0;r=i+t.length}}s(E5,"linkGlued");function T5(e,n){let t=e.default[n];return(typeof t!="string"||t.length===0)&&F(`notifications: slot "${e.key}" has no "${n}" text`),t}s(T5,"defaultText");function xL(e,n,t){let r=[],i=vL(e),o=e.placeholders??[],a=o.map(u=>u.key),l=o.filter(u=>u.subjectSafe===!0).map(u=>u.key);for(let[u,p]of Object.entries(n)){let h=i.find(y=>y.key===u);if(h===void 0){r.push({slotKey:u,code:"unknownSlot",message:i.length===0?{de:`Die Benachrichtigung \u201E${e.label}\u201C l\xE4sst sich nicht anpassen.`,en:`The notification "${e.label}" cannot be customized.`}:{de:`Der Baustein \u201E${u}\u201C geh\xF6rt nicht zur Benachrichtigung \u201E${e.label}\u201C.`,en:`The block "${u}" does not belong to the letter "${e.label}".`}});continue}if(p.trim().length===0){r.push({slotKey:u,code:"empty",message:{de:`\u201E${h.label}\u201C darf nicht leer sein. Zum Entfernen den Baustein zur\xFCcksetzen.`,en:`"${h.label}" must not be empty. To remove it, reset the block.`}});continue}if(p.length>cs){r.push({slotKey:u,code:"tooLong",message:{de:`\u201E${h.label}\u201C ist ${p.length} Zeichen lang, erlaubt sind ${cs}.`,en:`"${h.label}" is ${p.length} characters long; the limit is ${cs}.`}});continue}if($N(e)){A5.test(p)&&r.push({slotKey:u,code:"foreignUrl",message:{de:`\u201E${h.label}\u201C enth\xE4lt eine Adresse. Die Benachrichtigung \u201E${e.label}\u201C tr\xE4gt einen Anmeldeschl\xFCssel und darf keine weiteren Links enthalten.`,en:`"${h.label}" contains an address. The notification "${e.label}" carries a sign-in key and must not contain any further links.`}});for(let y of o)y.link!==!0||!E5(p,y.key)||r.push({slotKey:u,code:"linkNotStandalone",message:{de:`\u201E{{${y.key}}}\u201C (${y.label}) muss f\xFCr sich stehen \u2014 davor und dahinter nur ein Leerzeichen, ein Zeilenumbruch oder ein Satzzeichen.`,en:`"{{${y.key}}}" (${y.label}) must stand on its own \u2014 only a space, a line break or punctuation before and after it.`}})}for(let y of Xm(p)){if(!a.includes(y)){r.push({slotKey:u,code:"unknownPlaceholder",message:y===ii?{de:`\u201E{{${ii}}}\u201C (${Wa}) geh\xF6rt in die Anrede der Schule (unter \u201EAnrede und Gru\xDFformel\u201C), nicht in \u201E${h.label}\u201C \u2014 dort gibt es eine neutrale Anrede, wenn kein Name bekannt ist.`,en:`"{{${ii}}}" (${Wa}) belongs in the school's greeting (under \u201CGreeting and sign-off\u201D), not in "${h.label}" \u2014 the greeting has a neutral form for when no name is known.`}:a.length===0?{de:`Die Benachrichtigung \u201E${e.label}\u201C kennt keine Platzhalter, \u201E{{${y}}}\u201C bliebe unersetzt stehen.`,en:`The notification "${e.label}" has no placeholders; "{{${y}}}" would stay in the text unreplaced.`}:{de:`\u201E{{${y}}}\u201C gibt es in \u201E${e.label}\u201C nicht. Erlaubt: ${a.map(w=>`{{${w}}}`).join(", ")}.`,en:`"{{${y}}}" does not exist in "${e.label}". Allowed: ${a.map(w=>`{{${w}}}`).join(", ")}.`}});continue}if(u!==sd||l.includes(y))continue;let k=o.find(w=>w.key===y)?.label??y;r.push({slotKey:u,code:"subjectUnsupported",message:{de:`\u201E{{${y}}}\u201C (${k}) l\xE4sst sich im Betreff nicht einsetzen \u2014 der Wert entsteht erst beim Versand. `+(l.length===0?"In dieser Benachrichtigung kann der Betreff keine Platzhalter tragen.":`Im Betreff m\xF6glich: ${l.map(w=>`{{${w}}}`).join(", ")}.`),en:`"{{${y}}}" (${k}) cannot be used in the subject \u2014 the value only exists when the mail is sent. `+(l.length===0?"In this letter the subject cannot carry placeholders.":`Possible in the subject: ${l.map(w=>`{{${w}}}`).join(", ")}.`)}})}}let d=s(u=>n[u]??R5(i,u,t),"textOf"),c=S5(e);for(let u of o){if(u.required!==!0)continue;let p=c.filter(w=>!Xm(w.map(d).join(`
|
|
11625
|
-
`)).includes(u.key));if(p.length===0)continue;let h=s((w,b)=>w.map(T=>b(i.find(E=>E.key===T)?.label??T)).join(" + "),"variantLabel"),y=c.length===1?"":` Er fehlt in der Fassung aus ${p.map(w=>h(w,b=>`\u201E${b}\u201C`)).join(" und in der aus ")}.`,k=c.length===1?"":` It is missing in the version made of ${p.map(w=>h(w,b=>`"${b}"`)).join(" and in the one made of ")}.`;r.push({slotKey:u.key,code:"missingRequired",message:{de:`Ohne \u201E{{${u.key}}}\u201C (${u.label}) funktioniert die Benachrichtigung \u201E${e.label}\u201C nicht \u2014 der Platzhalter muss im Text stehen, nicht nur im Betreff.`+y,en:`Without "{{${u.key}}}" (${u.label}) the notification "${e.label}" does not work \u2014 the placeholder must be in the text, not only in the subject.`+k}})}return r}s(xL,"validateOverride");function R5(e,n,t){let r=e.find(i=>i.key===n);return r===void 0?"":T5(r,t)}s(R5,"defaultTextOf");function Wb(e){let n=e?.trim();return n===void 0||n.length===0?void 0:n}s(Wb,"normalizeChromeText");var us=s(e=>String.fromCharCode(e),"cp"),$5=new RegExp(`[${us(0)}-${us(31)}${us(127)}]`,"g"),I5=new RegExp(`[${us(8234)}-${us(8238)}${us(8294)}-${us(8297)}]`,"g");var O5=200;function _5(e,n=O5){return e.replace($5," ").replace(I5,"").replace(/\s+/g," ").trim().slice(0,n)}s(_5,"sanitizeHeaderValue");function eh(e){return _5(e.replace(/["<>@]/g,""),100)}s(eh,"sanitizeDisplayName");var Yb={de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}},P5={greeting:{de:"Anrede",en:"Greeting"},closing:{de:"Gru\xDFformel",en:"Closing"}};function SL(e){let n=[],t=[];for(let i of["greeting","closing"]){let o=e[i];if(o===void 0)continue;let a=P5[i],l=Dn(o);l!=="not-localized"&&l.length>0&&l.length<Be.length&&t.push({de:`${a.de} fehlt auf ${l.map(d=>Yb[d].de).join(" und ")}`,en:`${a.en} is missing in ${l.map(d=>Yb[d].en).join(" and ")}`});for(let d of Be){let c=dk(h=>`${a[h]} (${Yb[d][h]})`),u=Wb(o[d]);u!==void 0&&u.length>cs&&n.push({de:`${c.de} hat ${u.length} Zeichen \u2014 h\xF6chstens ${cs}; Anrede und Gru\xDFformel sind je eine Zeile der Mail, kein Dokument.`,en:`${c.en} has ${u.length} characters \u2014 at most ${cs}; the greeting and the sign-off are one line of the mail each, not a document.`});let p=i==="greeting"?[ii]:[];for(let h of Xm(u??""))p.includes(h)||n.push(p.length===0?{de:`${c.de} kann keine Platzhalter tragen \u2014 \u201E{{${h}}}\u201C bliebe unersetzt stehen.`,en:`${c.en} cannot carry placeholders \u2014 "{{${h}}}" would stay in the text unreplaced.`}:{de:`\u201E{{${h}}}\u201C gibt es in der ${c.de} nicht. Erlaubt: {{${ii}}} (${Wa}).`,en:`"{{${h}}}" does not exist in the ${c.en}. Allowed: {{${ii}}} (${Wa}).`})}}t.length>0&&n.unshift({de:`[notification/chromeMissingTranslation] ${t.map(i=>i.de).join("; ")} \u2014 Anrede und Gru\xDFformel gelten f\xFCr jede Benachrichtigung, in jeder Sprache.`,en:`[notification/chromeMissingTranslation] ${t.map(i=>i.en).join("; ")} \u2014 the greeting and sign-off apply to every notification, in every language.`});let r=Wb(e.senderName);return r!==void 0&&eh(r)!==r&&n.push({de:`Absendername (senderName) \u201E${r}\u201C \xFCbersteht die Kopfzeile der Mail nicht unver\xE4ndert \u2014 er ginge als \u201E${eh(r)}\u201C hinaus. Keine Anf\xFChrungszeichen, spitzen Klammern, \u201E@\u201C oder Steuerzeichen.`,en:`The sender name (senderName) "${r}" does not survive the mail header unchanged \u2014 it would go out as "${eh(r)}". No quotation marks, angle brackets, "@" or control characters.`}),n}s(SL,"chromeFindings");var AL=m.object({family:m.string()}),EL=m.object({family:m.string(),url:m.optional(m.string())}),iRe=m.object({heading:m.optional(EL),body:m.optional(EL)}),N5=m.union(m.literal("sharp"),m.literal("rounded"),m.literal("soft")),C5=m.union(m.literal("light"),m.literal("dark")),D5=m.union(m.literal("sm"),m.literal("md"),m.literal("lg"),m.literal("max")),F5=m.union(m.literal("compact"),m.literal("normal"),m.literal("spacious")),L5=m.object({primary:m.optional(m.string()),accent:m.optional(m.string()),background:m.optional(m.string()),foreground:m.optional(m.string())}),M5=m.object({heading:m.optional(AL),body:m.optional(AL)}),oRe=m.object({colors:m.optional(L5),radius:m.optional(N5),logoSize:m.optional(D5),bannerDensity:m.optional(F5),logoGround:m.optional(C5),filledHeader:m.optional(m.boolean()),websiteUrl:m.optional(m.string()),fonts:m.optional(M5)}),sRe=m.object({primaryUrl:m.union(m.null(),m.string())}),aRe=m.literal("primary"),lRe=m.object({headingUrl:m.union(m.null(),m.string()),bodyUrl:m.union(m.null(),m.string())}),dRe=m.union(m.literal("heading"),m.literal("body")),nh=["logo","fontHeading","fontBody"],TL={logo:null,fontHeading:"heading",fontBody:"body"};function RL(e){let{contentType:n,size:t}=e;return n==null||!n.startsWith("image/")?{de:`Das Logo muss ein Bild sein (erhalten: \u201E${n??"unbekannt"}\u201C).`,en:`The logo must be an image (received: "${n??"unknown"}").`}:n.startsWith("image/svg")?{de:"Das Logo muss eine Rastergrafik sein (PNG, JPEG oder GIF) \u2013 E-Mail-Programme zeigen SVG nicht an.",en:"The logo must be a raster image (PNG, JPEG or GIF) \u2013 email clients do not display SVG."}:t>3e6?{de:`Das Logo ist zu gro\xDF (${t} Byte, h\xF6chstens 3000000 Byte).`,en:`The logo is too large (${t} bytes, at most 3000000 bytes).`}:null}s(RL,"logoFileProblem");var Hb="font/woff2";var q5=["Inter Variable","Azeret Mono Variable","Source Sans 3 Variable"];function $L(e){return e?.trim()?q5.some(n=>n.toLowerCase()===e.trim().toLowerCase())?{de:`\u201E${e}\u201C ist die Schrift von Plexus selbst \u2013 w\xE4hlen Sie f\xFCr eine eigene Datei einen anderen Familiennamen.`,en:`"${e}" is Plexus's own typeface \u2013 choose a different family name for your own file.`}:null:{de:"Speichern Sie zuerst die Schriftfamilie \u2013 die Datei wird unter diesem Namen eingebunden.",en:"Save the font family first \u2013 the file is registered under that name."}}s($L,"fontFamilyProblem");var K5=["approved","rejected","withdrawn","waitlist","expired"];var th=["admitted","rejected","withdrawn","waitlist","expired","unknown"],gRe=m.union(...K5.map(e=>m.literal(e))),yRe=m.union(...th.map(e=>m.literal(e))),j5=["approved","rejected","waitlist"],V5=["withdrawn","expired"],B5=m.union(...j5.map(e=>m.literal(e))),U5=m.union(...V5.map(e=>m.literal(e))),wRe={active:{status:m.literal("active")},completed:{status:m.literal("completed"),outcome:B5,endedAt:m.number()},aborted:{status:m.literal("aborted"),outcome:m.optional(U5),endedAt:m.number()}};var IL=30,OL=3650;var G5=m.object({admitted:m.optional(m.number()),rejected:m.optional(m.number()),withdrawn:m.optional(m.number()),expired:m.optional(m.number()),waitlist:m.optional(m.number()),unknown:m.optional(m.number())}),ARe=G5.fields,z5=s(e=>th.includes(e),"isClassification");function _L(e,n="tenant.retentionDays"){if(e===null||typeof e!="object"||Array.isArray(e))return[`[retention/shape] ${n} must be an object of days per classification (got ${JSON.stringify(e)}).`];let t=[];for(let[r,i]of Object.entries(e)){if(!z5(r)){t.push(`[retention/unknownClassification] ${n}.${r} is no retention classification \u2014 one of ${th.join(", ")}.`);continue}(typeof i!="number"||!Number.isSafeInteger(i)||i<IL||i>OL)&&t.push(`[retention/days] ${n}.${r} must be a whole number of days from ${IL} to ${OL} (got ${JSON.stringify(i)}).`)}return t}s(_L,"retentionDaysFindings");var W5=["ad","ae","af","ag","ai","al","am","ao","aq","ar","as","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bl","bm","bn","bo","bq","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it","je","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mf","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","sv","sx","sy","sz","tc","td","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","xk","ye","yt","za","zm","zw"],Y5=new Set(W5);function rh(e){return Y5.has(e)}s(rh,"isCountryCode");var Jb=["off","always","deviating"],PL={mode:"deviating",defaultCountryCode:"de"};var H5=["street","plz","ort"];function J5(e){return H5.filter(n=>!e.has(n))}s(J5,"missingInvoiceAddressParts");var Q5=new Set(["0-1-select","0-n-select"]);function NL(e){return e===void 0?null:new Set(e.properties.flatMap(n=>n.addressPart!==void 0&&aP(n.addressPart)?[n.addressPart]:[]))}s(NL,"declaredAddressParts");function Z5(e){return Q5.has(e)}s(Z5,"isSelectFieldKind");function CL(e){let n=[];for(let o of e)if(o.isNationality&&(Z5(o.kind)?o.listKind!=="country"&&n.push({code:"nationality/notCountryList",fieldKey:o.key}):n.push({code:"nationality/wrongFieldKind",fieldKey:o.key})),o.isAccountEmail&&o.kind!=="email"&&n.push({code:"accountEmail/wrongFieldKind",fieldKey:o.key}),o.isContactPhone&&o.kind!=="tel"&&n.push({code:"contactPhone/wrongFieldKind",fieldKey:o.key}),o.isInvoiceAddress)if(o.addressParts===null)n.push({code:"invoiceAddress/wrongFieldKind",fieldKey:o.key});else{let a=J5(o.addressParts);a.length>0&&n.push({code:"invoiceAddress/missingPart",fieldKey:o.key,parts:a})}let t=e.filter(o=>o.isAccountEmail);if(t.length>1)for(let o of t)n.push({code:"accountEmail/multiple",fieldKey:o.key});let r=e.filter(o=>o.isContactPhone);if(r.length>1)for(let o of r)n.push({code:"contactPhone/multiple",fieldKey:o.key});let i=e.filter(o=>o.isInvoiceAddress);if(i.length>1)for(let o of i)n.push({code:"invoiceAddress/multiple",fieldKey:o.key});return n}s(CL,"fieldRoleFindings");function DL(e,n,...t){let r=e[n.code];return r(n,...t)}s(DL,"wordListElementFinding");function FL(e,n){let t=[];for(let r of n){if(e.kind==="plain"){r.countryCode!==void 0&&t.push({code:"list/countryCodeOnPlain",elementKey:r.key,countryCode:r.countryCode});continue}r.countryCode===void 0?t.push({code:"list/countryCodeMissing",elementKey:r.key}):r.countryCode!==null&&!rh(r.countryCode)&&t.push({code:"list/unknownCountryCode",elementKey:r.key,countryCode:r.countryCode})}return t}s(FL,"listElementCountryFindings");var eQ={key:!0,tenant:!0,foundation:!0,source:!0,displayGroups:!0,lists:!0,roles:!0,fields:!0,roleFields:!0,contractRoleMappings:!0,templatePlaceholders:!0,searchTargets:!0,searchFilters:!0,partyResultIcons:!0,notificationLetters:!0,admission:!0,files:!0,agent:!0,deferredColumns:!0,ignoredColumns:!0},nQ={slug:!0,name:!0,enabledModules:!0,permissions:!0,defaultApplicantGroupKey:!0,defaultEnrolleeRoleKey:!0,priceCriteriaFacts:!0,defaultInteressentRoleKey:!0,admissionFieldDisplayGroupKey:!0,defaultStartInProxy:!0,terms:!0,retentionDays:!0,mailLevel:!0,notificationChrome:!0,hideMailLevelNotice:!0,unassignedTaskNoticeDays:!0,familyMail:!0,testMailRecipients:!0,magicLinkLogin:!0,externalSignIn:!0,nationalityFlag:!0,adminSeesSignatureImages:!0,signatureStamp:!0,bankImportScope:!0,branding:!0,brandingAssets:!0,partyRetention:!0},tQ=new Set(["enabledMailCategories","mailEnabled"]);function rQ(e){let n=s((t,r,i)=>t.filter(o=>!Object.hasOwn(r,o)&&!(i==="tenant."&&tQ.has(o))).map(o=>`[config/unknownKey] ${i}${o} is not a config field of this release \u2014 a typo, or a field a newer release introduced.`),"unknown");return[...n(Object.keys(e),eQ,""),...n(Object.keys(e.tenant),nQ,"tenant.")]}s(rQ,"unknownKeyFindings");var LL=["plain","country"],iQ={"list/countryCodeMissing":s(({elementKey:e},n)=>`Element "${n}.${e}" of a country list must state countryCode (null for no state).`,"list/countryCodeMissing"),"list/countryCodeOnPlain":s(({elementKey:e},n)=>`Element "${n}.${e}" carries countryCode, but list "${n}" is not kind "country".`,"list/countryCodeOnPlain"),"list/unknownCountryCode":s(({elementKey:e,countryCode:n},t)=>`Element "${t}.${e}" has unknown countryCode ${JSON.stringify(n)}.`,"list/unknownCountryCode")},oQ={"nationality/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isNationality but not a 0-1-select / 0-n-select.`,"nationality/wrongFieldKind"),"nationality/notCountryList":s(({fieldKey:e})=>`Field "${e}" is isNationality but its list is not kind "country".`,"nationality/notCountryList"),"accountEmail/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isAccountEmail but not an email field.`,"accountEmail/wrongFieldKind"),"accountEmail/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isAccountEmail fields \u2014 at most one per tenant.`,"accountEmail/multiple"),"contactPhone/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isContactPhone but not a tel field.`,"contactPhone/wrongFieldKind"),"contactPhone/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isContactPhone fields \u2014 at most one per tenant.`,"contactPhone/multiple"),"invoiceAddress/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isInvoiceAddress but not an object field.`,"invoiceAddress/wrongFieldKind"),"invoiceAddress/missingPart":s(({fieldKey:e,parts:n})=>`Field "${e}" is isInvoiceAddress but declares no property for the address part(s) ${n.join(", ")} (objectSchema.properties[].addressPart) \u2014 an invoice cannot print its address without them.`,"invoiceAddress/missingPart"),"invoiceAddress/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isInvoiceAddress fields \u2014 at most one per tenant.`,"invoiceAddress/multiple")};function sQ(e){let n=oQ[e.code];return n(e)}s(sQ,"roleText");function aQ(e){let n=[],t=e.tenant.nationalityFlag,r=typeof t=="object"&&t!==null?t:{},i=r.mode;if(Jb.includes(i)||n.push(`[nationality/flagMode] tenant.nationalityFlag.mode must be one of ${Jb.join(", ")} (got ${t===void 0?"no tenant.nationalityFlag":JSON.stringify(i??null)}).`),t!==void 0){let l=r.defaultCountryCode;(typeof l!="string"||!rh(l))&&n.push(`[nationality/defaultCountryCode] tenant.nationalityFlag.defaultCountryCode must be a lowercase ISO 3166-1 alpha-2 code (got ${JSON.stringify(l??null)}).`)}let o=new Map;for(let l of e.lists){let d=l.kind;if(!LL.includes(d)){n.push(`[list/kind] List "${l.key}" has kind ${JSON.stringify(d??null)} \u2014 one of ${LL.join(", ")}.`);continue}o.set(l.key,l.kind);for(let c of FL({key:l.key,kind:l.kind},l.elements))n.push(`[${c.code}] ${DL(iQ,c,l.key)}`)}let a=CL(e.fields.map(l=>({key:l.key,kind:l.type,listKind:l.listKey===void 0?null:o.get(l.listKey)??null,isNationality:l.isNationality===!0,isAccountEmail:l.isAccountEmail===!0,isContactPhone:l.isContactPhone===!0,isInvoiceAddress:l.isInvoiceAddress===!0,addressParts:l.type==="object"?NL(l.objectSchema??{properties:[]}):null})));for(let l of a)n.push(`[${l.code}] ${sQ(l)}`);return n}s(aQ,"nationalityFindings");function ML(e){return qi(e)?.message.de??(e instanceof Error?e.message:String(e))}s(ML,"errorText");function jL(e,n={}){let t=[...rQ(e)],r=[];try{cL(e.fields.map(v=>v.key),[])}catch(v){t.push(ML(v))}e.tenant.terms!==void 0&&t.push(...zb(e.tenant.terms)),e.tenant.retentionDays!==void 0&&t.push(..._L(e.tenant.retentionDays)),EN(e.tenant.mailLevel)?e.tenant.mailLevel==="all"&&!Cd(e.tenant.enabledModules,"notifications")&&t.push('[notification/levelWithoutModule] tenant.mailLevel is "all" but the notifications module is not enabled \u2014 only sign-in and security mail would go out. Enable the module or set "loginOnly".'):t.push(`[notification/mailLevel] tenant.mailLevel must be one of ${bk.join(", ")} (got ${e.tenant.mailLevel===void 0?"nothing":JSON.stringify(e.tenant.mailLevel)}).`);let i=e.tenant.testMailRecipients;i!==void 0&&(!Array.isArray(i)||i.length===0||!i.every(v=>typeof v=="string"&&Mb(v).includes("@"))?t.push("[notification/testRecipients] tenant.testMailRecipients must be a non-empty list of login addresses (leave it out for no test recipients)."):new Set(i.map(v=>Mb(v))).size!==i.length&&t.push("[notification/testRecipients] tenant.testMailRecipients names an address twice."),(e.tenant.mailLevel!=="loginOnly"||!Cd(e.tenant.enabledModules,"notifications"))&&t.push('[notification/testRecipientsWithoutEffect] tenant.testMailRecipients decides only at mailLevel "loginOnly" with the notifications module on \u2014 at "all" everybody gets mail, with the module off nobody. Remove the list or change the level.')),"enabledMailCategories"in e.tenant&&t.push('[notification/mailCategoriesRetired] tenant.enabledMailCategories was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),"mailEnabled"in e.tenant&&t.push('[notification/mailEnabledRetired] tenant.mailEnabled was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),En(e.displayGroups.map(v=>v.key),"display group",t),En(e.lists.map(v=>v.key),"list",t),En(e.roles.map(v=>v.key),"role",t),En(e.fields.map(v=>v.key),"field",t),En(e.foundation.legalEntities.map(v=>v.key),"legal entity",t),En(e.foundation.units.map(v=>v.key),"unit",t),En(e.foundation.permissionGroups.map(v=>v.key),"permission group",t),"teams"in e.foundation&&t.push("foundation.teams is retired: a team is a permission group \u2014 move each team to foundation.permissionGroups (same key) and remove the block.");for(let v of e.foundation.users)"teamKeys"in v&&t.push(`User "${v.email}" carries teamKeys, retired: team membership is the user's permission-group membership.`);if(En(e.foundation.users.map(v=>v.key),"user",t),En((e.searchFilters??[]).map(v=>v.key),"search filter",t),En((e.searchTargets??[]).map(v=>v.objectPropertyKey===void 0?v.fieldKey:`${v.fieldKey}.${v.objectPropertyKey}`),"search target",t),En((e.partyResultIcons??[]).map(v=>v.key),"party result icon",t),En((e.templatePlaceholders??[]).map(v=>v.key),"template placeholder",t),En((e.notificationLetters??[]).map(VL),"notification letter",t),hQ(e.notificationLetters??[],t),gQ(e.tenant.notificationChrome,t),e.tenant.bankImportScope!==void 0&&!["sepa_only","full_statement"].includes(e.tenant.bankImportScope)&&t.push("tenant.bankImportScope must be sepa_only or full_statement."),e.tenant.hideMailLevelNotice!==void 0&&typeof e.tenant.hideMailLevelNotice!="boolean"&&t.push("tenant.hideMailLevelNotice must be true or false (the dashboard's mail-level notice)."),e.tenant.unassignedTaskNoticeDays!==void 0&&!TN(e.tenant.unassignedTaskNoticeDays)&&t.push("tenant.unassignedTaskNoticeDays must be a whole number from 1 to 30 (days before an unassigned team task is reported); leave it out for the platform default."),e.tenant.familyMail!==void 0)for(let v of oL(e.tenant.familyMail))t.push(`tenant.${v}; leave it out for the platform default.`);typeof e.tenant.magicLinkLogin!="boolean"&&t.push("tenant.magicLinkLogin must be true or false (the login page's sign-in link option)."),typeof e.tenant.adminSeesSignatureImages!="boolean"&&t.push("tenant.adminSeesSignatureImages must be true or false (whether a school administrator sees other accounts' signature images)."),typeof e.tenant.signatureStamp!="boolean"&&t.push("tenant.signatureStamp must be true or false (whether the school offers the signature stamp at the countersignature)."),aL(e.tenant.externalSignIn)?t.push(`[auth/externalSignInRetired] tenant.externalSignIn names the retired mode "${String(e.tenant.externalSignIn.mode)}" \u2014 every sign-in link now signs in once; state { mode: "oneTimeLink" }.`):sL(e.tenant.externalSignIn)||t.push('[auth/externalSignIn] tenant.externalSignIn must be { mode: "oneTimeLink" } (how families sign in).');let o=new Set(e.displayGroups.map(v=>v.key)),a=new Set(e.lists.map(v=>v.key)),l=new Set(e.roles.map(v=>v.key)),d=new Set(e.fields.map(v=>v.key)),c=new Map(e.fields.map(v=>[v.key,v])),u=new Set(e.foundation.legalEntities.map(v=>v.key)),p=new Set(e.foundation.units.map(v=>v.key)),h=new Set(e.foundation.permissionGroups.map(v=>v.key));Cd(e.tenant.enabledModules,"bewerbungsmanagement")&&e.tenant.defaultApplicantGroupKey!==void 0&&(e.foundation.permissionGroups.find(P=>P.key===e.tenant.defaultApplicantGroupKey)?.permissions.includes("bewerbungsmanagement.applications.submitOwn")||t.push(`Default applicant group "${e.tenant.defaultApplicantGroupKey}" must grant submitOwn.`));let y=e.tenant.admissionFieldDisplayGroupKey;y!==void 0&&!o.has(y)&&t.push(`tenant.admissionFieldDisplayGroupKey "${y}" names no display group of this config.`),y===void 0&&(Cd(e.tenant.enabledModules,"bewerbungsmanagement")||(e.admission?.fields.length??0)>0)&&t.push("tenant.admissionFieldDisplayGroupKey is required when admissions is enabled or admission.fields declares fields: it names the display group the fields an offer creates land in."),t.push(...aQ(e)),En(e.fields.flatMap(v=>(v.relationshipKinds??[]).map(P=>P.key)),"relationship kind",t);for(let v of e.fields){o.has(v.displayGroupKey)||t.push(`Field "${v.key}" references missing display group "${v.displayGroupKey}".`),dQ(v,t),v.formWritable===!0&&!Bb[v.type].fieldMapTarget&&t.push(`Field "${v.key}" is formWritable, but a form cannot write a "${v.type}" field.`),v.type==="files"&&v.shareable===!0&&t.push(`[field/filesShareable] Field "${v.key}" is a files field and cannot be shareable.`),v.type==="auto-string"?cQ(v,c,t):v.autoString!==void 0&&t.push(`Non-automatic field "${v.key}" must not define autoString.`),(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Field "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`),(v.type==="0-1-select"||v.type==="0-n-select")&&!v.listKey&&t.push(`Select field "${v.key}" must define listKey.`),v.type!=="0-1-select"&&v.type!=="0-n-select"&&v.listKey!==void 0&&t.push(`Non-select field "${v.key}" must not define listKey.`),v.listKey&&!a.has(v.listKey)&&t.push(`Field "${v.key}" references missing list "${v.listKey}".`),(v.type==="object"||v.type==="relationship")&&!v.objectSchema&&t.push(`Field "${v.key}" must define objectSchema.`),v.type!=="object"&&v.type!=="relationship"&&v.objectSchema&&t.push(`Non-object field "${v.key}" must not define objectSchema.`);for(let P of v.objectSchema?.properties??[])(P.type==="0-1-select"||P.type==="0-n-select")&&!P.listKey&&t.push(`Object select property "${v.key}.${P.key}" must define listKey.`),P.listKey&&!a.has(P.listKey)&&t.push(`Object property "${v.key}.${P.key}" references missing list "${P.listKey}".`);lQ(v,t)}let k=e.tenant.priceCriteriaFacts;if(k){let v=e.fields.find(P=>P.key===k.birthDateFieldKey);(!v||v.type!=="date")&&t.push("Price criteria require a configured date field for birth dates."),l.has(k.studentRoleKey)||t.push("Price criteria require a configured Student eligibility role."),k.siblingRankSource!==void 0&&k.siblingRankSource!=="derived"&&k.siblingRankSource!=="chosen"&&t.push('Price criteria siblingRankSource must be "derived" or "chosen".');for(let P of Object.keys(k))P!=="birthDateFieldKey"&&P!=="studentRoleKey"&&P!=="siblingRankSource"&&t.push(`Unknown price criteria fact setting "${P}".`)}let w=e.tenant.defaultEnrolleeRoleKey;w&&!l.has(w)&&t.push(`Default enrollment role "${w}" does not exist.`),w&&e.roles.some(v=>v.parentRoleKey===w)&&t.push(`Default enrollment role "${w}" must be a leaf role.`);for(let v of e.roles){(typeof v.icon!="string"||v.icon.trim().length===0)&&t.push(`Role "${v.key}" must define an icon.`),v.parentRoleKey&&!l.has(v.parentRoleKey)&&t.push(`Role "${v.key}" references missing parent role "${v.parentRoleKey}".`);for(let P of v.listDisplayFieldKeys??[])d.has(P)||t.push(`Role "${v.key}" list display references missing field "${P}".`)}let b=new Map(e.roles.map(v=>[v.key,v.parentRoleKey])),T=new Map;for(let v of e.roleFields){let P=T.get(v.roleKey)??[];P.push({roleId:v.roleKey,customFieldId:v.fieldKey}),T.set(v.roleKey,P)}for(let v of e.roles)try{lL(v.key,b,T)}catch(P){t.push(ML(P))}for(let v of e.roleFields){l.has(v.roleKey)||t.push(`Role field references missing role "${v.roleKey}" for field "${v.fieldKey}".`),d.has(v.fieldKey)||t.push(`Role field references missing field "${v.fieldKey}" for role "${v.roleKey}".`);for(let P of v.targetRequirementFieldKeys??[])d.has(P)||t.push(`Role field "${v.roleKey}.${v.fieldKey}" references missing target requirement field "${P}".`)}mQ(e.contractRoleMappings??[],l,t);for(let v of e.templatePlaceholders??[])LF.test(v.key)||t.push(`Template placeholder "${v.key}" must use lower_snake_case segments, optionally separated by dots.`),v.source.kind==="customField"?ih(v.source,c,t,`Template placeholder "${v.key}"`):v.source.kind==="relationshipTargetField"&&uQ(v,c,t);for(let v of e.searchTargets??[])ih(v,c,t,"Search target");for(let v of e.fields)hL(v.key)&&(v.defaultValue!==void 0||v.validations!==void 0)&&t.push(`System field "${v.key}" takes no defaultValue or validations.`);for(let v of e.lists)if(En(v.elements.map((P,A)=>String(P.sortOrder??(A+1)*10)),`sortOrder of an element of list "${v.key}"`,t),v.labelOrder!==void 0){let P=v.labelOrder.last;if(!Array.isArray(P)||P.some(A=>typeof A!="string")){t.push(`[list/labelOrder] List "${v.key}" states labelOrder.last ${JSON.stringify(P??null)} \u2014 a list of element keys.`);continue}En(v.labelOrder.last,`labelOrder.last key of list "${v.key}"`,t);for(let A of jP(v.labelOrder,v.elements.map(M=>M.key)))t.push(`[list/labelOrder] List "${v.key}" keeps "${A}" at the end, but has no element "${A}".`)}for(let v of e.searchFilters??[])En((v.options??[]).map((P,A)=>String(P.sortOrder??(A+1)*10)),`sortOrder of an option of search filter "${v.key}"`,t);for(let v of e.foundation.permissionGroups){v.grantAllCustomFields===!0&&v.customFieldPermissions!==void 0&&t.push(`Permission group "${v.key}" states both grantAllCustomFields and customFieldPermissions \u2014 one of them.`),En((v.customFieldPermissions??[]).map(P=>P.displayGroupKey),`display group of a field permission of group "${v.key}"`,t);for(let P of v.customFieldPermissions??[]){o.has(P.displayGroupKey)||t.push(`Permission group "${v.key}" grants field permissions on missing display group "${P.displayGroupKey}".`);for(let A of P.permissions)fL.includes(A)||t.push(`Permission group "${v.key}" grants unknown field permission "${A}".`)}}let E=e.tenant.partyRetention;E!==void 0&&(mL(E.days)||t.push(`tenant.partyRetention.days must be a whole number of days from 1 to ${36500} (got ${JSON.stringify(E.days)}).`),Number.isFinite(E.enabledAt)||t.push("tenant.partyRetention.enabledAt must be a timestamp (epoch ms)."),E.formerRoleKey!==void 0&&!l.has(E.formerRoleKey)&&t.push(`tenant.partyRetention references missing role "${E.formerRoleKey}".`));for(let v of e.searchFilters??[]){(v.kind==="chips"||v.kind==="select")&&(v.options?.length??0)===0&&t.push(`Search filter "${v.key}" must define options.`),(v.kind==="text"||v.kind==="numberRange")&&v.target===void 0&&t.push(`Search filter "${v.key}" must define a target field.`),v.options!==void 0&&En(v.options.map(P=>P.key),`search filter option for "${v.key}"`,t),ih(v.target,c,t,`Search filter "${v.key}"`);for(let P of v.options??[]){P.predicates.length===0&&t.push(`Search filter option "${v.key}.${P.key}" must define at least one predicate.`);for(let A of P.predicates){if(A.kind==="role"){l.has(A.roleKey)||t.push(`Search filter option "${v.key}.${P.key}" references missing role "${A.roleKey}".`);continue}ih(A,c,t,`Search filter option "${v.key}.${P.key}"`)}}}for(let v of e.partyResultIcons??[])fQ(v,c,t);for(let v of e.foundation.legalEntities)if(v.terms!==void 0&&t.push(...zb(v.terms,`foundation.legalEntities.${v.key}.terms`)),qL(v.branding,t,`foundation.legalEntities.${v.key}.branding`),KL(v,t,`foundation.legalEntities.${v.key}`),v.signatoryUserKey!==void 0&&v.type==="school_group"&&t.push(`[config/signatoryOnGroup] Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) declares an Unterschriftsperson.`),v.parentLegalEntityKey&&!u.has(v.parentLegalEntityKey)&&t.push(`Legal entity "${v.key}" references missing parent "${v.parentLegalEntityKey}".`),v.address!==void 0){let P=v.address,A=["street","hausnr","plz","ort"];v.type==="school_group"?t.push(`Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) has an address.`):(typeof P!="object"||P===null||Array.isArray(P)||Object.keys(P).some(M=>!A.includes(M))||A.some(M=>typeof P[M]!="string"||(P[M]??"").trim()===""))&&t.push(`Legal entity "${v.key}" has an invalid address \u2014 expected { street, hausnr, plz, ort }, each non-empty.`)}let $=new Map;for(let v of e.foundation.units){if(v.slug!==void 0){let P=typeof v.slug=="string"?wO(v.slug):"must be a string";P!==void 0&&t.push(`Unit "${v.key}" has invalid slug "${v.slug}" (${P}).`);let A=$.get(v.slug);A!==void 0&&t.push(`Units "${A}" and "${v.key}" both declare slug "${v.slug}" (unit slugs are unique per tenant).`),$.set(v.slug,v.key)}u.has(v.legalEntityKey)||t.push(`Unit "${v.key}" references missing legal entity "${v.legalEntityKey}".`),v.parentUnitKey&&!p.has(v.parentUnitKey)&&t.push(`Unit "${v.key}" references missing parent unit "${v.parentUnitKey}".`),v.sortOrder!==void 0&&(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Unit "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`)}let C=/^[0-9a-f]{32}:[0-9a-f]{128}$/;for(let v of e.foundation.users){h.has(v.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${v.permissionGroupKey}".`),v.unitKey&&!p.has(v.unitKey)&&t.push(`User "${v.email}" references missing unit "${v.unitKey}".`),v.status!==void 0&&v.status!=="deactivated"&&t.push(`User "${v.email}": status must be "deactivated" or absent, not "${String(v.status)}".`);let P=[v,...v.additionalMemberships??[]];for(let M of v.additionalMemberships??[])h.has(M.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${M.permissionGroupKey}".`),M.unitKey&&!p.has(M.unitKey)&&t.push(`User "${v.email}" references missing unit "${M.unitKey}".`);En(P.map(M=>`${M.permissionGroupKey}/${M.unitKey??""}`),`membership (permission group/unit) of user "${v.email}"`,t);for(let M of P)M.validFrom!==void 0&&M.validTo!==void 0&&M.validTo<=M.validFrom&&t.push(`User "${v.email}": membership "${M.permissionGroupKey}" ends (validTo) before it starts (validFrom).`);let A=[v.firstName,v.lastName];A.some(M=>M!==void 0)&&A.some(M=>typeof M!="string"||M.trim()==="")&&t.push(`[config/userNameIncomplete] User "${v.email}" states only part of firstName/lastName (or an empty one) \u2014 set both or neither.`);for(let M of["staging","prod"]){let U=v.passwordHashes?.[M];U!==void 0&&!C.test(U)&&t.push(`User "${v.email}" passwordHashes.${M} is not in Better Auth scrypt format "<32hex>:<128hex>".`)}}qL(e.tenant.branding,t),KL(e.tenant,t);let L=BL(e.fields.flatMap(v=>v.sourceColumns));for(let v of L)r.push(`Source column "${v}" is mapped by more than one field.`);kQ(e,t);let _=n.sourceColumns===void 0||e.source===void 0?void 0:yQ(e,n.sourceColumns,t);return{ok:t.length===0,errors:t,warnings:r,coverage:_}}s(jL,"validateTenantConfig");function lQ(e,n){let t=new Map;for(let r of e.objectSchema?.properties??[]){let i=r.addressPart;if(i===void 0)continue;let o=`Object property "${e.key}.${r.key}"`;if(!Jw.includes(i)){n.push(`${o}: addressPart "${i}" is none of ${Jw.join(", ")}.`);continue}e.type!=="object"&&n.push(`${o}: only an object field stores an address (addressPart).`),r.type!=="string"&&n.push(`${o}: addressPart "${i}" needs a string property, not "${r.type}".`);let a=t.get(i);a!==void 0&&n.push(`${o}: addressPart "${i}" is already declared by "${e.key}.${a}".`),t.set(i,r.key)}}s(lQ,"validateAddressParts");function dQ(e,n){let t=e.relationshipKinds;if(t===void 0)return;if(e.type!=="relationship"){n.push(`Field "${e.key}" declares relationshipKinds, but only a relationship field carries them.`);return}let r=new Map((e.objectSchema?.properties??[]).map(i=>[i.key,i]));for(let i of t){let o=`Field "${e.key}" relationship kind "${i.key}"`;if(typeof i.key!="string"||i.key.trim()===""){n.push(`Field "${e.key}": a relationship kind needs a key.`);continue}for(let l of["de","en"])(i.label?.[l]??"").trim()===""&&n.push(`${o}: label.${l} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);if(i.edge===null||typeof i.edge!="object"||Array.isArray(i.edge)){n.push(`${o}: edge must be an object.`);continue}i.sibling!==void 0&&i.sibling!==!0&&n.push(`${o}: sibling must be true or absent.`),i.sibling===!0&&i.mergeInto!==void 0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare mergeInto.`);let a=t.flatMap(l=>l.mergeInto!==void 0?[l.mergeInto]:[]);if(i.sibling===!0&&a.some(l=>l in i.edge)&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare a property another kind of the field merges into.`),i.sibling===!0&&Object.keys(i.edge).length===0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 an empty edge would count every edge of the field.`),i.mergeInto!==void 0){let l=r.get(i.mergeInto);l===void 0||l.type!=="0-n-select"?n.push(`${o}: mergeInto "${i.mergeInto}" must name a 0-n-select property of the field's objectSchema.`):Array.isArray(i.edge[i.mergeInto])||n.push(`${o}: mergeInto "${i.mergeInto}" must be set to a list in the edge.`)}}}s(dQ,"validateRelationshipKinds");function cQ(e,n,t){if(e.autoString===void 0){t.push(`Automatic field "${e.key}" must define autoString.`);return}e.allowMultiple===!0&&t.push(`Automatic field "${e.key}" must not allow multiple values.`),e.shareable===!0&&t.push(`Automatic field "${e.key}" must not be shareable.`),e.autoString.segments.length===0&&t.push(`Automatic field "${e.key}" must define at least one segment.`),e.autoString.segments.filter(i=>i.kind==="sequence").length!==1&&t.push(`Automatic field "${e.key}" must define exactly one sequence segment.`);for(let i of e.autoString.segments)if(i.kind==="literal"&&i.value.length===0&&t.push(`Automatic field "${e.key}" has an empty literal segment.`),i.kind==="sequence"&&(i.startAt!==void 0&&(!Number.isInteger(i.startAt)||i.startAt<1)&&t.push(`Automatic field "${e.key}" sequence startAt must be an integer >= 1.`),i.minDigits!==void 0&&(!Number.isInteger(i.minDigits)||i.minDigits<0)&&t.push(`Automatic field "${e.key}" sequence minDigits must be an integer >= 0.`)),i.kind==="field"){let o=n.get(i.fieldKey);if(o===void 0){t.push(`Automatic field "${e.key}" references missing field "${i.fieldKey}".`);continue}i.objectPropertyKey!==void 0&&o.objectSchema?.properties.find(l=>l.key===i.objectPropertyKey)===void 0&&t.push(`Automatic field "${e.key}" references missing object property "${i.fieldKey}.${i.objectPropertyKey}".`)}}s(cQ,"validateAutomaticStringField");function ih(e,n,t,r){if(e===void 0)return;let i=n.get(e.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.fieldKey}".`);return}if(e.objectPropertyKey===void 0)return;(i.objectSchema?.properties.some(a=>a.key===e.objectPropertyKey)??!1)||t.push(`${r} references missing object property "${e.fieldKey}.${e.objectPropertyKey}".`)}s(ih,"validateSearchTarget");function uQ(e,n,t){if(e.source.kind!=="relationshipTargetField")return;let r=`Template placeholder "${e.key}"`,i=n.get(e.source.relationshipFieldKey);if(i===void 0)t.push(`${r} references missing relationship field "${e.source.relationshipFieldKey}".`);else if(i.type!=="relationship")t.push(`${r} relationship field "${e.source.relationshipFieldKey}" must be a relationship field.`);else{for(let a of e.source.edgeFilters??[])Qb(i,a.propertyKey,t,`${r} edge filter`);e.source.selection?.sortPropertyKey!==void 0&&Qb(i,e.source.selection.sortPropertyKey,t,`${r} selection sort`)}let o=n.get(e.source.targetFieldKey);if(o===void 0){t.push(`${r} references missing target field "${e.source.targetFieldKey}".`);return}o.type==="relationship"&&t.push(`${r} target field "${e.source.targetFieldKey}" must not be a relationship field.`),e.source.targetObjectPropertyKey!==void 0&&Qb(o,e.source.targetObjectPropertyKey,t,`${r} target`)}s(uQ,"validateRelationshipTemplatePlaceholder");function Qb(e,n,t,r){(e.objectSchema?.properties.some(o=>o.key===n)??!1)||t.push(`${r} references missing object property "${e.key}.${n}".`)}s(Qb,"validateObjectPropertyReference");function fQ(e,n,t){let r=`Party result icon "${e.key}"`,i=n.get(e.when.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.when.fieldKey}".`);return}if(e.when.objectPropertyKey===void 0){i.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`);return}let o=i.objectSchema?.properties.find(a=>a.key===e.when.objectPropertyKey);if(o===void 0){t.push(`${r} references missing object property "${e.when.fieldKey}.${e.when.objectPropertyKey}".`);return}o.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`)}s(fQ,"validatePartyResultIconTarget");function VL(e){return`${e.templateId}:${e.locale}:${e.scopeKey}`}s(VL,"letterIdentity");function pQ(e){return`${e.generatorKey??"*"}/${e.partyKind}/${e.roleKey}`}s(pQ,"contractRoleMappingIdentity");function mQ(e,n,t){let r=new Set;for(let i of e){let o=pQ(i),a=`Contract role mapping "${o}"`;qb.includes(i.partyKind)||t.push(`${a}: partyKind must be one of ${qb.join(", ")}.`),i.partyKind==="beneficiary"&&t.push(`${a}: a beneficiary holds the enrollee role of the program it attends (programs.enrolleeRoleKey, else tenant.defaultEnrolleeRoleKey) \u2014 remove the mapping.`),n.has(i.roleKey)||t.push(`${a} references missing role "${i.roleKey}".`),i.generatorKey!==void 0&&i.generatorKey.trim()===""&&t.push(`${a}: generatorKey must not be blank \u2014 omit it for the tenant default.`),r.has(o)&&t.push(`${a} is declared twice.`),r.add(o)}}s(mQ,"validateContractRoleMappings");function hQ(e,n){for(let t of e){let r=`Notification letter "${VL(t)}"`;if(!Zm(t.locale)){n.push(`${r} declares locale "${String(t.locale)}" \u2014 letters are written in ${Be.map(i=>`"${i}"`).join(" and ")} only, so no mail would ever read this deviation.`);continue}if(t.scopeKey!==Jm){n.push(`${r} declares scopeKey "${t.scopeKey}" \u2014 the only scope is "${Jm}" (the whole school).`);continue}if(Object.keys(t.slots).length===0){n.push(`${r} overrides no block. A deviation that deviates in nothing is not an entry \u2014 remove it.`);continue}if(!Rk(t.templateId)){n.push(`${r} references no registered letter \u2014 "${t.templateId}" is not in the letter catalog.`);continue}for(let i of xL(Tk(t.templateId),t.slots,t.locale))n.push(`${r}, block "${i.slotKey}" [${i.code}]: ${i.message.de}`)}}s(hQ,"validateNotificationLetters");function gQ(e,n){if(e!==void 0)for(let t of SL(e))n.push(`Notification chrome: ${t.de}`)}s(gQ,"validateNotificationChrome");function qL(e,n,t){if(e===void 0)return;let r=t===void 0?n:{push:s((...p)=>n.push(...p.map(h=>`${t}: ${h}`)),"push")},i=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,o=/^(?:rgb|rgba|hsl|hsla)\(.+\)$/i,a=s(p=>i.test(p.trim())||o.test(p.trim()),"isColor");for(let[p,h]of Object.entries(e.colors??{}))h!==void 0&&(a(h)||r.push(`Branding color "colors.${p}" has invalid value "${h}" (expected hex "#rgb"/"#rrggbb"/"#rrggbbaa" or rgb()/rgba()/hsl()/hsla()).`));let l=["sharp","rounded","soft"];e.radius!==void 0&&!l.includes(e.radius)&&r.push(`Branding radius "${e.radius}" is invalid (expected "sharp", "rounded", or "soft").`);let d=["sm","md","lg","max"];e.logoSize!==void 0&&!d.includes(e.logoSize)&&r.push(`Branding logoSize "${e.logoSize}" is invalid (expected "sm", "md", "lg", or "max").`);let c=["compact","normal","spacious"];e.bannerDensity!==void 0&&!c.includes(e.bannerDensity)&&r.push(`Branding bannerDensity "${e.bannerDensity}" is invalid (expected "compact", "normal", or "spacious").`);let u=["light","dark"];e.logoGround!==void 0&&!u.includes(e.logoGround)&&r.push(`Branding logoGround "${e.logoGround}" is invalid (expected "light" or "dark").`),e.websiteUrl!==void 0&&!e.websiteUrl.startsWith("https://")&&r.push(`Branding websiteUrl must be an https:// URL (got "${e.websiteUrl}").`);for(let p of["heading","body"]){let h=e.fonts?.[p];h!==void 0&&((typeof h.family!="string"||h.family.trim().length===0)&&r.push(`Branding font "fonts.${p}" must define a non-empty family.`),Object.hasOwn(h,"url")&&r.push(`Branding font "fonts.${p}.url" is no longer supported \u2014 the font file is uploaded (plexus-cli branding set-font --slot ${p} --file <woff2>) and config carries the family only.`))}}s(qL,"validateBranding");function KL(e,n,t="tenant"){let r=e.brandingAssets;if(r!==void 0){if(typeof r!="object"||r===null||Array.isArray(r)){n.push(`${t}.brandingAssets must be an object keyed by slot (${nh.join(", ")}).`);return}for(let[i,o]of Object.entries(r)){let a=`${t}.brandingAssets.${i}`;if(!nh.includes(i)){n.push(`${a}: unknown slot (expected ${nh.join(", ")}).`);continue}if(typeof o!="object"||o===null){n.push(`${a}: must be { sha256, sizeBytes, mimeType }.`);continue}if("size"in o){n.push(`[config/fileRefRenamed] ${a} still names size \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}UL.test(o.sha256??"")||n.push(`${a}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(o.sizeBytes)||o.sizeBytes<=0)&&n.push(`${a}: sizeBytes must be a positive integer.`);let l=TL[i];if(l===null){let d=RL({contentType:o.mimeType,size:o.sizeBytes});d!==null&&n.push(`${a}: ${d.de}`)}else{o.mimeType!==Hb&&n.push(`${a}: mimeType must be "${Hb}" (got "${o.mimeType}").`);let d=$L(e.branding?.fonts?.[l]?.family);d!==null&&n.push(`${a}: [branding/fontFamilyMissing] ${t}.branding.fonts.${l}: ${d.de}`)}"path"in o&&n.push(`${a}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}}s(KL,"validateBrandingAssets");function yQ(e,n,t){let{source:r}=e;r===void 0&&F("validateSourceCoverage: called without a `source` block.");let i=new Set(n),o=new Set(e.fields.flatMap(k=>k.sourceColumns)),a=new Set(e.deferredColumns.map(k=>k.column)),l=new Set(e.ignoredColumns.map(k=>k.column)),d=new Set([...o,...a,...l]),c=r.requiredColumns.filter(k=>!i.has(k)),u=n.filter(k=>!d.has(k)),p=[...o].filter(k=>!i.has(k)),h=[...a].filter(k=>!i.has(k)),y=[...l].filter(k=>!i.has(k));for(let k of c)t.push(`Required source column "${k}" is missing from ${r.primaryTable}.`);for(let k of u)t.push(`Source column "${k}" is neither mapped nor explicitly deferred/ignored.`);for(let k of p)t.push(`Mapped source column "${k}" does not exist in the source schema.`);for(let k of h)t.push(`Deferred source column "${k}" does not exist in the source schema.`);for(let k of y)t.push(`Ignored source column "${k}" does not exist in the source schema.`);return{table:r.primaryTable,availableColumns:n.length,mappedColumns:[...o].filter(k=>i.has(k)).length,deferredColumns:[...a].filter(k=>i.has(k)).length,ignoredColumns:[...l].filter(k=>i.has(k)).length,missingRequiredColumns:c,unmappedColumns:u,unknownMappedColumns:p,unknownDeferredColumns:h,unknownIgnoredColumns:y}}s(yQ,"validateSourceCoverage");function En(e,n,t){for(let r of BL(e))t.push(`Duplicate ${n} key "${r}".`)}s(En,"requireUnique");function BL(e){let n=new Set,t=new Set;for(let r of e)n.has(r)&&t.add(r),n.add(r);return[...t]}s(BL,"duplicates");var UL=/^[0-9a-f]{64}$/,wQ=["fileName","size"];function kQ(e,n){if(!Array.isArray(e.files)){n.push('"files" is missing \u2014 declare the file library (an empty list is fine).');return}En(e.files.map(t=>t.key),"file",n);for(let t of e.files){let r=`files["${t.key}"]`;ja(t.key)||n.push(`${r}: key must match ${hb}.`);for(let o of["de","en"])(t.label?.[o]??"").trim()===""&&n.push(`${r}: label.${o} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);let i=wQ.filter(o=>o in t);if(i.length>0){n.push(`[config/fileRefRenamed] ${r} still names ${i.join(", ")} \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now filename / sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}if(typeof t.filename!="string")n.push(`${r}: filename is missing.`);else{let o=ls(t.filename);o!==null&&n.push(`${r}: filename ${o}.`)}Qm.includes(t.mimeType)||n.push(`${r}: mimeType "${t.mimeType}" is not allowed (${Qm.join(", ")}).`),UL.test(t.sha256??"")||n.push(`${r}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(t.sizeBytes)||t.sizeBytes<=0)&&n.push(`${r}: sizeBytes must be a positive integer.`),"path"in t&&n.push(`${r}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}s(kQ,"validateFiles");var bQ=new WeakMap,vQ=new WeakSet;function Zb(e,n){n(e);let r=e.asOptional.bind(e);return Object.defineProperty(e,"asOptional",{value:s(()=>Zb(r(),n),"value"),enumerable:!1}),e}s(Zb,"carry");function Ya(e,n){return Zb(e,t=>bQ.set(t,n))}s(Ya,"tagged");var xQ="tenant teardown drains every table explicitly (config/wipe.ts)",Ue={belongsTo:s(e=>Ya(e,{kind:"belongsTo"}),"belongsTo"),owns:s(e=>Ya(e,{kind:"owns"}),"owns"),holds:s(e=>Ya(e,{kind:"holds"}),"holds"),restrict:s((e,n)=>Ya(e,n?{kind:"restrict",unindexed:n.unindexed}:{kind:"restrict"}),"restrict"),history:s(e=>Ya(e,{kind:"history"}),"history"),tenant:s(e=>Ya(e,{kind:"restrict",unindexed:xQ}),"tenant"),historyOf:s(e=>Zb(e,n=>vQ.add(n)),"historyOf")};var SQ=m.object({street:m.string(),hausnr:m.string(),plz:m.string(),ort:m.string()}),GL=m.union(m.literal("school_operator"),m.literal("school_group"),m.literal("service_entity")),oi=GL.members.map(e=>e.value),AQ={tenantId:Ue.tenant(m.id("tenants")),name:m.optional(m.string()),type:GL,parentLegalEntityId:m.optional(Ue.restrict(m.id("legal_entities"))),configKey:m.optional(m.string()),partyId:m.optional(Ue.restrict(m.id("parties"))),address:m.optional(SQ),signatoryUserId:m.optional(Ue.restrict(m.id("users"))),terms:m.optional(bL)},A$e=Kt(AQ).index("by_tenantId",["tenantId"]).index("by_parentLegalEntityId",["parentLegalEntityId"]).index("by_tenantId_and_configKey",["tenantId","configKey"]).index("by_partyId",["partyId"]).index("by_signatoryUserId",["signatoryUserId"]);var EQ=m.union(m.literal("school"),m.literal("kindergarten"),m.literal("after_school_care"),m.literal("department"),m.literal("site"),m.literal("other")),zt=EQ.members.map(e=>e.value),R$e=m.union(m.literal("school"),m.literal("vocational"),m.literal("care"),m.literal("seminar"),m.literal("other")),$$e=m.union(m.literal("none"),m.literal("manual"),m.literal("annual_rollover")),I$e=m.union(m.literal("grade_level"),m.literal("module"),m.literal("phase"),m.literal("other")),O$e=m.union(m.literal("school_year"),m.literal("cohort"),m.literal("seminar"),m.literal("care_period"),m.literal("other")),_$e=m.union(m.literal("planned"),m.literal("active"),m.literal("completed"),m.literal("archived")),P$e=m.union(m.literal("class"),m.literal("course"),m.literal("care_group"),m.literal("seminar_group"),m.literal("mixed_age_group"),m.literal("other")),N$e=m.union(m.literal("planned"),m.literal("active"),m.literal("completed"),m.literal("cancelled")),C$e=m.union(m.literal("class_teacher"),m.literal("teacher"),m.literal("mentor"),m.literal("instructor"),m.literal("assistant"),m.literal("other")),D$e=m.union(m.literal("units"),m.literal("unit_profiles"),m.literal("programs"),m.literal("program_stages"),m.literal("program_runs"),m.literal("learning_groups"),m.literal("enrollments"),m.literal("learning_group_staff_assignments")),F$e=m.union(m.literal("open"),m.literal("mapped"),m.literal("ignored"));function WL(e){let n=["street","hausnr","plz","ort"].filter(t=>e[t]!==void 0);if(n.length!==0){if(n.length!==4)throw new Error(`config legal-entity add: an address needs all of --street, --hausnr, --plz and --ort (got ${n.map(t=>`--${t}`).join(", ")})`);return{street:e.street,hausnr:e.hausnr,plz:e.plz,ort:e.ort}}}s(WL,"addressFrom");function YL(e){if(!oi.includes(e))throw new Error(`config legal-entity add: --type "${e}" is none of ${oi.join(", ")}`);return e}s(YL,"legalEntityType");function HL(e){if(!zt.includes(e))throw new Error(`config unit add: --kind "${e}" is none of ${zt.join(", ")}`);return e}s(HL,"unitKind");function JL(e,n,t){let r=e.find(i=>i.key===n.key);if(r===void 0)return e.push(n),"create";if(Pe(r)===Pe(n))return"same";throw new Error(`${t} "${n.key}" already exists with other values \u2014 decide by hand, nothing written.
|
|
11625
|
+
`)).includes(u.key));if(p.length===0)continue;let h=s((w,b)=>w.map(T=>b(i.find(E=>E.key===T)?.label??T)).join(" + "),"variantLabel"),y=c.length===1?"":` Er fehlt in der Fassung aus ${p.map(w=>h(w,b=>`\u201E${b}\u201C`)).join(" und in der aus ")}.`,k=c.length===1?"":` It is missing in the version made of ${p.map(w=>h(w,b=>`"${b}"`)).join(" and in the one made of ")}.`;r.push({slotKey:u.key,code:"missingRequired",message:{de:`Ohne \u201E{{${u.key}}}\u201C (${u.label}) funktioniert die Benachrichtigung \u201E${e.label}\u201C nicht \u2014 der Platzhalter muss im Text stehen, nicht nur im Betreff.`+y,en:`Without "{{${u.key}}}" (${u.label}) the notification "${e.label}" does not work \u2014 the placeholder must be in the text, not only in the subject.`+k}})}return r}s(xL,"validateOverride");function R5(e,n,t){let r=e.find(i=>i.key===n);return r===void 0?"":T5(r,t)}s(R5,"defaultTextOf");function Wb(e){let n=e?.trim();return n===void 0||n.length===0?void 0:n}s(Wb,"normalizeChromeText");var us=s(e=>String.fromCharCode(e),"cp"),$5=new RegExp(`[${us(0)}-${us(31)}${us(127)}]`,"g"),I5=new RegExp(`[${us(8234)}-${us(8238)}${us(8294)}-${us(8297)}]`,"g");var O5=200;function _5(e,n=O5){return e.replace($5," ").replace(I5,"").replace(/\s+/g," ").trim().slice(0,n)}s(_5,"sanitizeHeaderValue");function eh(e){return _5(e.replace(/["<>@]/g,""),100)}s(eh,"sanitizeDisplayName");var Yb={de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}},P5={greeting:{de:"Anrede",en:"Greeting"},closing:{de:"Gru\xDFformel",en:"Closing"}};function SL(e){let n=[],t=[];for(let i of["greeting","closing"]){let o=e[i];if(o===void 0)continue;let a=P5[i],l=Dn(o);l!=="not-localized"&&l.length>0&&l.length<Be.length&&t.push({de:`${a.de} fehlt auf ${l.map(d=>Yb[d].de).join(" und ")}`,en:`${a.en} is missing in ${l.map(d=>Yb[d].en).join(" and ")}`});for(let d of Be){let c=dk(h=>`${a[h]} (${Yb[d][h]})`),u=Wb(o[d]);u!==void 0&&u.length>cs&&n.push({de:`${c.de} hat ${u.length} Zeichen \u2014 h\xF6chstens ${cs}; Anrede und Gru\xDFformel sind je eine Zeile der Mail, kein Dokument.`,en:`${c.en} has ${u.length} characters \u2014 at most ${cs}; the greeting and the sign-off are one line of the mail each, not a document.`});let p=i==="greeting"?[ii]:[];for(let h of Xm(u??""))p.includes(h)||n.push(p.length===0?{de:`${c.de} kann keine Platzhalter tragen \u2014 \u201E{{${h}}}\u201C bliebe unersetzt stehen.`,en:`${c.en} cannot carry placeholders \u2014 "{{${h}}}" would stay in the text unreplaced.`}:{de:`\u201E{{${h}}}\u201C gibt es in der ${c.de} nicht. Erlaubt: {{${ii}}} (${Wa}).`,en:`"{{${h}}}" does not exist in the ${c.en}. Allowed: {{${ii}}} (${Wa}).`})}}t.length>0&&n.unshift({de:`[notification/chromeMissingTranslation] ${t.map(i=>i.de).join("; ")} \u2014 Anrede und Gru\xDFformel gelten f\xFCr jede Benachrichtigung, in jeder Sprache.`,en:`[notification/chromeMissingTranslation] ${t.map(i=>i.en).join("; ")} \u2014 the greeting and sign-off apply to every notification, in every language.`});let r=Wb(e.senderName);return r!==void 0&&eh(r)!==r&&n.push({de:`Absendername (senderName) \u201E${r}\u201C \xFCbersteht die Kopfzeile der Mail nicht unver\xE4ndert \u2014 er ginge als \u201E${eh(r)}\u201C hinaus. Keine Anf\xFChrungszeichen, spitzen Klammern, \u201E@\u201C oder Steuerzeichen.`,en:`The sender name (senderName) "${r}" does not survive the mail header unchanged \u2014 it would go out as "${eh(r)}". No quotation marks, angle brackets, "@" or control characters.`}),n}s(SL,"chromeFindings");var AL=m.object({family:m.string()}),EL=m.object({family:m.string(),url:m.optional(m.string())}),nRe=m.object({heading:m.optional(EL),body:m.optional(EL)}),N5=m.union(m.literal("sharp"),m.literal("rounded"),m.literal("soft")),C5=m.union(m.literal("light"),m.literal("dark")),D5=m.union(m.literal("sm"),m.literal("md"),m.literal("lg"),m.literal("max")),F5=m.union(m.literal("compact"),m.literal("normal"),m.literal("spacious")),L5=m.object({primary:m.optional(m.string()),accent:m.optional(m.string()),background:m.optional(m.string()),foreground:m.optional(m.string())}),M5=m.object({heading:m.optional(AL),body:m.optional(AL)}),tRe=m.object({colors:m.optional(L5),radius:m.optional(N5),logoSize:m.optional(D5),bannerDensity:m.optional(F5),logoGround:m.optional(C5),filledHeader:m.optional(m.boolean()),websiteUrl:m.optional(m.string()),fonts:m.optional(M5)}),rRe=m.object({primaryUrl:m.union(m.null(),m.string())}),iRe=m.literal("primary"),oRe=m.object({headingUrl:m.union(m.null(),m.string()),bodyUrl:m.union(m.null(),m.string())}),sRe=m.union(m.literal("heading"),m.literal("body")),nh=["logo","fontHeading","fontBody"],TL={logo:null,fontHeading:"heading",fontBody:"body"};function RL(e){let{contentType:n,size:t}=e;return n==null||!n.startsWith("image/")?{de:`Das Logo muss ein Bild sein (erhalten: \u201E${n??"unbekannt"}\u201C).`,en:`The logo must be an image (received: "${n??"unknown"}").`}:n.startsWith("image/svg")?{de:"Das Logo muss eine Rastergrafik sein (PNG, JPEG oder GIF) \u2013 E-Mail-Programme zeigen SVG nicht an.",en:"The logo must be a raster image (PNG, JPEG or GIF) \u2013 email clients do not display SVG."}:t>3e6?{de:`Das Logo ist zu gro\xDF (${t} Byte, h\xF6chstens 3000000 Byte).`,en:`The logo is too large (${t} bytes, at most 3000000 bytes).`}:null}s(RL,"logoFileProblem");var Hb="font/woff2";var q5=["Inter Variable","Azeret Mono Variable","Source Sans 3 Variable"];function $L(e){return e?.trim()?q5.some(n=>n.toLowerCase()===e.trim().toLowerCase())?{de:`\u201E${e}\u201C ist die Schrift von Plexus selbst \u2013 w\xE4hlen Sie f\xFCr eine eigene Datei einen anderen Familiennamen.`,en:`"${e}" is Plexus's own typeface \u2013 choose a different family name for your own file.`}:null:{de:"Speichern Sie zuerst die Schriftfamilie \u2013 die Datei wird unter diesem Namen eingebunden.",en:"Save the font family first \u2013 the file is registered under that name."}}s($L,"fontFamilyProblem");var K5=["approved","rejected","withdrawn","waitlist","expired"];var th=["admitted","rejected","withdrawn","waitlist","expired","unknown"],pRe=m.union(...K5.map(e=>m.literal(e))),mRe=m.union(...th.map(e=>m.literal(e))),j5=["approved","rejected","waitlist"],V5=["withdrawn","expired"],B5=m.union(...j5.map(e=>m.literal(e))),U5=m.union(...V5.map(e=>m.literal(e))),hRe={active:{status:m.literal("active")},completed:{status:m.literal("completed"),outcome:B5,endedAt:m.number()},aborted:{status:m.literal("aborted"),outcome:m.optional(U5),endedAt:m.number()}};var IL=30,OL=3650;var G5=m.object({admitted:m.optional(m.number()),rejected:m.optional(m.number()),withdrawn:m.optional(m.number()),expired:m.optional(m.number()),waitlist:m.optional(m.number()),unknown:m.optional(m.number())}),vRe=G5.fields,z5=s(e=>th.includes(e),"isClassification");function _L(e,n="tenant.retentionDays"){if(e===null||typeof e!="object"||Array.isArray(e))return[`[retention/shape] ${n} must be an object of days per classification (got ${JSON.stringify(e)}).`];let t=[];for(let[r,i]of Object.entries(e)){if(!z5(r)){t.push(`[retention/unknownClassification] ${n}.${r} is no retention classification \u2014 one of ${th.join(", ")}.`);continue}(typeof i!="number"||!Number.isSafeInteger(i)||i<IL||i>OL)&&t.push(`[retention/days] ${n}.${r} must be a whole number of days from ${IL} to ${OL} (got ${JSON.stringify(i)}).`)}return t}s(_L,"retentionDaysFindings");var W5=["ad","ae","af","ag","ai","al","am","ao","aq","ar","as","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bl","bm","bn","bo","bq","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it","je","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mf","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","sv","sx","sy","sz","tc","td","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","xk","ye","yt","za","zm","zw"],Y5=new Set(W5);function rh(e){return Y5.has(e)}s(rh,"isCountryCode");var Jb=["off","always","deviating"],PL={mode:"deviating",defaultCountryCode:"de"};var H5=["street","plz","ort"];function J5(e){return H5.filter(n=>!e.has(n))}s(J5,"missingInvoiceAddressParts");var Q5=new Set(["0-1-select","0-n-select"]);function NL(e){return e===void 0?null:new Set(e.properties.flatMap(n=>n.addressPart!==void 0&&aP(n.addressPart)?[n.addressPart]:[]))}s(NL,"declaredAddressParts");function Z5(e){return Q5.has(e)}s(Z5,"isSelectFieldKind");function CL(e){let n=[];for(let o of e)if(o.isNationality&&(Z5(o.kind)?o.listKind!=="country"&&n.push({code:"nationality/notCountryList",fieldKey:o.key}):n.push({code:"nationality/wrongFieldKind",fieldKey:o.key})),o.isAccountEmail&&o.kind!=="email"&&n.push({code:"accountEmail/wrongFieldKind",fieldKey:o.key}),o.isContactPhone&&o.kind!=="tel"&&n.push({code:"contactPhone/wrongFieldKind",fieldKey:o.key}),o.isInvoiceAddress)if(o.addressParts===null)n.push({code:"invoiceAddress/wrongFieldKind",fieldKey:o.key});else{let a=J5(o.addressParts);a.length>0&&n.push({code:"invoiceAddress/missingPart",fieldKey:o.key,parts:a})}let t=e.filter(o=>o.isAccountEmail);if(t.length>1)for(let o of t)n.push({code:"accountEmail/multiple",fieldKey:o.key});let r=e.filter(o=>o.isContactPhone);if(r.length>1)for(let o of r)n.push({code:"contactPhone/multiple",fieldKey:o.key});let i=e.filter(o=>o.isInvoiceAddress);if(i.length>1)for(let o of i)n.push({code:"invoiceAddress/multiple",fieldKey:o.key});return n}s(CL,"fieldRoleFindings");function DL(e,n,...t){let r=e[n.code];return r(n,...t)}s(DL,"wordListElementFinding");function FL(e,n){let t=[];for(let r of n){if(e.kind==="plain"){r.countryCode!==void 0&&t.push({code:"list/countryCodeOnPlain",elementKey:r.key,countryCode:r.countryCode});continue}r.countryCode===void 0?t.push({code:"list/countryCodeMissing",elementKey:r.key}):r.countryCode!==null&&!rh(r.countryCode)&&t.push({code:"list/unknownCountryCode",elementKey:r.key,countryCode:r.countryCode})}return t}s(FL,"listElementCountryFindings");var eQ={key:!0,tenant:!0,foundation:!0,source:!0,displayGroups:!0,lists:!0,roles:!0,fields:!0,roleFields:!0,contractRoleMappings:!0,templatePlaceholders:!0,searchTargets:!0,searchFilters:!0,partyResultIcons:!0,notificationLetters:!0,admission:!0,files:!0,agent:!0,deferredColumns:!0,ignoredColumns:!0},nQ={slug:!0,name:!0,enabledModules:!0,permissions:!0,defaultApplicantGroupKey:!0,defaultEnrolleeRoleKey:!0,priceCriteriaFacts:!0,defaultInteressentRoleKey:!0,admissionFieldDisplayGroupKey:!0,defaultStartInProxy:!0,terms:!0,retentionDays:!0,mailLevel:!0,notificationChrome:!0,hideMailLevelNotice:!0,unassignedTaskNoticeDays:!0,familyMail:!0,testMailRecipients:!0,magicLinkLogin:!0,externalSignIn:!0,nationalityFlag:!0,adminSeesSignatureImages:!0,signatureStamp:!0,bankImportScope:!0,branding:!0,brandingAssets:!0,partyRetention:!0},tQ=new Set(["enabledMailCategories","mailEnabled"]);function rQ(e){let n=s((t,r,i)=>t.filter(o=>!Object.hasOwn(r,o)&&!(i==="tenant."&&tQ.has(o))).map(o=>`[config/unknownKey] ${i}${o} is not a config field of this release \u2014 a typo, or a field a newer release introduced.`),"unknown");return[...n(Object.keys(e),eQ,""),...n(Object.keys(e.tenant),nQ,"tenant.")]}s(rQ,"unknownKeyFindings");var LL=["plain","country"],iQ={"list/countryCodeMissing":s(({elementKey:e},n)=>`Element "${n}.${e}" of a country list must state countryCode (null for no state).`,"list/countryCodeMissing"),"list/countryCodeOnPlain":s(({elementKey:e},n)=>`Element "${n}.${e}" carries countryCode, but list "${n}" is not kind "country".`,"list/countryCodeOnPlain"),"list/unknownCountryCode":s(({elementKey:e,countryCode:n},t)=>`Element "${t}.${e}" has unknown countryCode ${JSON.stringify(n)}.`,"list/unknownCountryCode")},oQ={"nationality/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isNationality but not a 0-1-select / 0-n-select.`,"nationality/wrongFieldKind"),"nationality/notCountryList":s(({fieldKey:e})=>`Field "${e}" is isNationality but its list is not kind "country".`,"nationality/notCountryList"),"accountEmail/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isAccountEmail but not an email field.`,"accountEmail/wrongFieldKind"),"accountEmail/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isAccountEmail fields \u2014 at most one per tenant.`,"accountEmail/multiple"),"contactPhone/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isContactPhone but not a tel field.`,"contactPhone/wrongFieldKind"),"contactPhone/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isContactPhone fields \u2014 at most one per tenant.`,"contactPhone/multiple"),"invoiceAddress/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isInvoiceAddress but not an object field.`,"invoiceAddress/wrongFieldKind"),"invoiceAddress/missingPart":s(({fieldKey:e,parts:n})=>`Field "${e}" is isInvoiceAddress but declares no property for the address part(s) ${n.join(", ")} (objectSchema.properties[].addressPart) \u2014 an invoice cannot print its address without them.`,"invoiceAddress/missingPart"),"invoiceAddress/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isInvoiceAddress fields \u2014 at most one per tenant.`,"invoiceAddress/multiple")};function sQ(e){let n=oQ[e.code];return n(e)}s(sQ,"roleText");function aQ(e){let n=[],t=e.tenant.nationalityFlag,r=typeof t=="object"&&t!==null?t:{},i=r.mode;if(Jb.includes(i)||n.push(`[nationality/flagMode] tenant.nationalityFlag.mode must be one of ${Jb.join(", ")} (got ${t===void 0?"no tenant.nationalityFlag":JSON.stringify(i??null)}).`),t!==void 0){let l=r.defaultCountryCode;(typeof l!="string"||!rh(l))&&n.push(`[nationality/defaultCountryCode] tenant.nationalityFlag.defaultCountryCode must be a lowercase ISO 3166-1 alpha-2 code (got ${JSON.stringify(l??null)}).`)}let o=new Map;for(let l of e.lists){let d=l.kind;if(!LL.includes(d)){n.push(`[list/kind] List "${l.key}" has kind ${JSON.stringify(d??null)} \u2014 one of ${LL.join(", ")}.`);continue}o.set(l.key,l.kind);for(let c of FL({key:l.key,kind:l.kind},l.elements))n.push(`[${c.code}] ${DL(iQ,c,l.key)}`)}let a=CL(e.fields.map(l=>({key:l.key,kind:l.type,listKind:l.listKey===void 0?null:o.get(l.listKey)??null,isNationality:l.isNationality===!0,isAccountEmail:l.isAccountEmail===!0,isContactPhone:l.isContactPhone===!0,isInvoiceAddress:l.isInvoiceAddress===!0,addressParts:l.type==="object"?NL(l.objectSchema??{properties:[]}):null})));for(let l of a)n.push(`[${l.code}] ${sQ(l)}`);return n}s(aQ,"nationalityFindings");function ML(e){return qi(e)?.message.de??(e instanceof Error?e.message:String(e))}s(ML,"errorText");function jL(e,n={}){let t=[...rQ(e)],r=[];try{cL(e.fields.map(v=>v.key),[])}catch(v){t.push(ML(v))}e.tenant.terms!==void 0&&t.push(...zb(e.tenant.terms)),e.tenant.retentionDays!==void 0&&t.push(..._L(e.tenant.retentionDays)),EN(e.tenant.mailLevel)?e.tenant.mailLevel==="all"&&!Cd(e.tenant.enabledModules,"notifications")&&t.push('[notification/levelWithoutModule] tenant.mailLevel is "all" but the notifications module is not enabled \u2014 only sign-in and security mail would go out. Enable the module or set "loginOnly".'):t.push(`[notification/mailLevel] tenant.mailLevel must be one of ${bk.join(", ")} (got ${e.tenant.mailLevel===void 0?"nothing":JSON.stringify(e.tenant.mailLevel)}).`);let i=e.tenant.testMailRecipients;i!==void 0&&(!Array.isArray(i)||i.length===0||!i.every(v=>typeof v=="string"&&Mb(v).includes("@"))?t.push("[notification/testRecipients] tenant.testMailRecipients must be a non-empty list of login addresses (leave it out for no test recipients)."):new Set(i.map(v=>Mb(v))).size!==i.length&&t.push("[notification/testRecipients] tenant.testMailRecipients names an address twice."),(e.tenant.mailLevel!=="loginOnly"||!Cd(e.tenant.enabledModules,"notifications"))&&t.push('[notification/testRecipientsWithoutEffect] tenant.testMailRecipients decides only at mailLevel "loginOnly" with the notifications module on \u2014 at "all" everybody gets mail, with the module off nobody. Remove the list or change the level.')),"enabledMailCategories"in e.tenant&&t.push('[notification/mailCategoriesRetired] tenant.enabledMailCategories was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),"mailEnabled"in e.tenant&&t.push('[notification/mailEnabledRetired] tenant.mailEnabled was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),En(e.displayGroups.map(v=>v.key),"display group",t),En(e.lists.map(v=>v.key),"list",t),En(e.roles.map(v=>v.key),"role",t),En(e.fields.map(v=>v.key),"field",t),En(e.foundation.legalEntities.map(v=>v.key),"legal entity",t),En(e.foundation.units.map(v=>v.key),"unit",t),En(e.foundation.permissionGroups.map(v=>v.key),"permission group",t),"teams"in e.foundation&&t.push("foundation.teams is retired: a team is a permission group \u2014 move each team to foundation.permissionGroups (same key) and remove the block.");for(let v of e.foundation.users)"teamKeys"in v&&t.push(`User "${v.email}" carries teamKeys, retired: team membership is the user's permission-group membership.`);if(En(e.foundation.users.map(v=>v.key),"user",t),En((e.searchFilters??[]).map(v=>v.key),"search filter",t),En((e.searchTargets??[]).map(v=>v.objectPropertyKey===void 0?v.fieldKey:`${v.fieldKey}.${v.objectPropertyKey}`),"search target",t),En((e.partyResultIcons??[]).map(v=>v.key),"party result icon",t),En((e.templatePlaceholders??[]).map(v=>v.key),"template placeholder",t),En((e.notificationLetters??[]).map(VL),"notification letter",t),hQ(e.notificationLetters??[],t),gQ(e.tenant.notificationChrome,t),e.tenant.bankImportScope!==void 0&&!["sepa_only","full_statement"].includes(e.tenant.bankImportScope)&&t.push("tenant.bankImportScope must be sepa_only or full_statement."),e.tenant.hideMailLevelNotice!==void 0&&typeof e.tenant.hideMailLevelNotice!="boolean"&&t.push("tenant.hideMailLevelNotice must be true or false (the dashboard's mail-level notice)."),e.tenant.unassignedTaskNoticeDays!==void 0&&!TN(e.tenant.unassignedTaskNoticeDays)&&t.push("tenant.unassignedTaskNoticeDays must be a whole number from 1 to 30 (days before an unassigned team task is reported); leave it out for the platform default."),e.tenant.familyMail!==void 0)for(let v of oL(e.tenant.familyMail))t.push(`tenant.${v}; leave it out for the platform default.`);typeof e.tenant.magicLinkLogin!="boolean"&&t.push("tenant.magicLinkLogin must be true or false (the login page's sign-in link option)."),typeof e.tenant.adminSeesSignatureImages!="boolean"&&t.push("tenant.adminSeesSignatureImages must be true or false (whether a school administrator sees other accounts' signature images)."),typeof e.tenant.signatureStamp!="boolean"&&t.push("tenant.signatureStamp must be true or false (whether the school offers the signature stamp at the countersignature)."),aL(e.tenant.externalSignIn)?t.push(`[auth/externalSignInRetired] tenant.externalSignIn names the retired mode "${String(e.tenant.externalSignIn.mode)}" \u2014 every sign-in link now signs in once; state { mode: "oneTimeLink" }.`):sL(e.tenant.externalSignIn)||t.push('[auth/externalSignIn] tenant.externalSignIn must be { mode: "oneTimeLink" } (how families sign in).');let o=new Set(e.displayGroups.map(v=>v.key)),a=new Set(e.lists.map(v=>v.key)),l=new Set(e.roles.map(v=>v.key)),d=new Set(e.fields.map(v=>v.key)),c=new Map(e.fields.map(v=>[v.key,v])),u=new Set(e.foundation.legalEntities.map(v=>v.key)),p=new Set(e.foundation.units.map(v=>v.key)),h=new Set(e.foundation.permissionGroups.map(v=>v.key));Cd(e.tenant.enabledModules,"bewerbungsmanagement")&&e.tenant.defaultApplicantGroupKey!==void 0&&(e.foundation.permissionGroups.find(P=>P.key===e.tenant.defaultApplicantGroupKey)?.permissions.includes("bewerbungsmanagement.applications.submitOwn")||t.push(`Default applicant group "${e.tenant.defaultApplicantGroupKey}" must grant submitOwn.`));let y=e.tenant.admissionFieldDisplayGroupKey;y!==void 0&&!o.has(y)&&t.push(`tenant.admissionFieldDisplayGroupKey "${y}" names no display group of this config.`),y===void 0&&(Cd(e.tenant.enabledModules,"bewerbungsmanagement")||(e.admission?.fields.length??0)>0)&&t.push("tenant.admissionFieldDisplayGroupKey is required when admissions is enabled or admission.fields declares fields: it names the display group the fields an offer creates land in."),t.push(...aQ(e)),En(e.fields.flatMap(v=>(v.relationshipKinds??[]).map(P=>P.key)),"relationship kind",t);for(let v of e.fields){o.has(v.displayGroupKey)||t.push(`Field "${v.key}" references missing display group "${v.displayGroupKey}".`),dQ(v,t),v.formWritable===!0&&!Bb[v.type].fieldMapTarget&&t.push(`Field "${v.key}" is formWritable, but a form cannot write a "${v.type}" field.`),v.type==="files"&&v.shareable===!0&&t.push(`[field/filesShareable] Field "${v.key}" is a files field and cannot be shareable.`),v.type==="auto-string"?cQ(v,c,t):v.autoString!==void 0&&t.push(`Non-automatic field "${v.key}" must not define autoString.`),(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Field "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`),(v.type==="0-1-select"||v.type==="0-n-select")&&!v.listKey&&t.push(`Select field "${v.key}" must define listKey.`),v.type!=="0-1-select"&&v.type!=="0-n-select"&&v.listKey!==void 0&&t.push(`Non-select field "${v.key}" must not define listKey.`),v.listKey&&!a.has(v.listKey)&&t.push(`Field "${v.key}" references missing list "${v.listKey}".`),(v.type==="object"||v.type==="relationship")&&!v.objectSchema&&t.push(`Field "${v.key}" must define objectSchema.`),v.type!=="object"&&v.type!=="relationship"&&v.objectSchema&&t.push(`Non-object field "${v.key}" must not define objectSchema.`);for(let P of v.objectSchema?.properties??[])(P.type==="0-1-select"||P.type==="0-n-select")&&!P.listKey&&t.push(`Object select property "${v.key}.${P.key}" must define listKey.`),P.listKey&&!a.has(P.listKey)&&t.push(`Object property "${v.key}.${P.key}" references missing list "${P.listKey}".`);lQ(v,t)}let k=e.tenant.priceCriteriaFacts;if(k){let v=e.fields.find(P=>P.key===k.birthDateFieldKey);(!v||v.type!=="date")&&t.push("Price criteria require a configured date field for birth dates."),l.has(k.studentRoleKey)||t.push("Price criteria require a configured Student eligibility role."),k.siblingRankSource!==void 0&&k.siblingRankSource!=="derived"&&k.siblingRankSource!=="chosen"&&t.push('Price criteria siblingRankSource must be "derived" or "chosen".');for(let P of Object.keys(k))P!=="birthDateFieldKey"&&P!=="studentRoleKey"&&P!=="siblingRankSource"&&t.push(`Unknown price criteria fact setting "${P}".`)}let w=e.tenant.defaultEnrolleeRoleKey;w&&!l.has(w)&&t.push(`Default enrollment role "${w}" does not exist.`),w&&e.roles.some(v=>v.parentRoleKey===w)&&t.push(`Default enrollment role "${w}" must be a leaf role.`);for(let v of e.roles){(typeof v.icon!="string"||v.icon.trim().length===0)&&t.push(`Role "${v.key}" must define an icon.`),v.parentRoleKey&&!l.has(v.parentRoleKey)&&t.push(`Role "${v.key}" references missing parent role "${v.parentRoleKey}".`);for(let P of v.listDisplayFieldKeys??[])d.has(P)||t.push(`Role "${v.key}" list display references missing field "${P}".`)}let b=new Map(e.roles.map(v=>[v.key,v.parentRoleKey])),T=new Map;for(let v of e.roleFields){let P=T.get(v.roleKey)??[];P.push({roleId:v.roleKey,customFieldId:v.fieldKey}),T.set(v.roleKey,P)}for(let v of e.roles)try{lL(v.key,b,T)}catch(P){t.push(ML(P))}for(let v of e.roleFields){l.has(v.roleKey)||t.push(`Role field references missing role "${v.roleKey}" for field "${v.fieldKey}".`),d.has(v.fieldKey)||t.push(`Role field references missing field "${v.fieldKey}" for role "${v.roleKey}".`);for(let P of v.targetRequirementFieldKeys??[])d.has(P)||t.push(`Role field "${v.roleKey}.${v.fieldKey}" references missing target requirement field "${P}".`)}mQ(e.contractRoleMappings??[],l,t);for(let v of e.templatePlaceholders??[])LF.test(v.key)||t.push(`Template placeholder "${v.key}" must use lower_snake_case segments, optionally separated by dots.`),v.source.kind==="customField"?ih(v.source,c,t,`Template placeholder "${v.key}"`):v.source.kind==="relationshipTargetField"&&uQ(v,c,t);for(let v of e.searchTargets??[])ih(v,c,t,"Search target");for(let v of e.fields)hL(v.key)&&(v.defaultValue!==void 0||v.validations!==void 0)&&t.push(`System field "${v.key}" takes no defaultValue or validations.`);for(let v of e.lists)if(En(v.elements.map((P,A)=>String(P.sortOrder??(A+1)*10)),`sortOrder of an element of list "${v.key}"`,t),v.labelOrder!==void 0){let P=v.labelOrder.last;if(!Array.isArray(P)||P.some(A=>typeof A!="string")){t.push(`[list/labelOrder] List "${v.key}" states labelOrder.last ${JSON.stringify(P??null)} \u2014 a list of element keys.`);continue}En(v.labelOrder.last,`labelOrder.last key of list "${v.key}"`,t);for(let A of jP(v.labelOrder,v.elements.map(M=>M.key)))t.push(`[list/labelOrder] List "${v.key}" keeps "${A}" at the end, but has no element "${A}".`)}for(let v of e.searchFilters??[])En((v.options??[]).map((P,A)=>String(P.sortOrder??(A+1)*10)),`sortOrder of an option of search filter "${v.key}"`,t);for(let v of e.foundation.permissionGroups){v.grantAllCustomFields===!0&&v.customFieldPermissions!==void 0&&t.push(`Permission group "${v.key}" states both grantAllCustomFields and customFieldPermissions \u2014 one of them.`),En((v.customFieldPermissions??[]).map(P=>P.displayGroupKey),`display group of a field permission of group "${v.key}"`,t);for(let P of v.customFieldPermissions??[]){o.has(P.displayGroupKey)||t.push(`Permission group "${v.key}" grants field permissions on missing display group "${P.displayGroupKey}".`);for(let A of P.permissions)fL.includes(A)||t.push(`Permission group "${v.key}" grants unknown field permission "${A}".`)}}let E=e.tenant.partyRetention;E!==void 0&&(mL(E.days)||t.push(`tenant.partyRetention.days must be a whole number of days from 1 to ${36500} (got ${JSON.stringify(E.days)}).`),Number.isFinite(E.enabledAt)||t.push("tenant.partyRetention.enabledAt must be a timestamp (epoch ms)."),E.formerRoleKey!==void 0&&!l.has(E.formerRoleKey)&&t.push(`tenant.partyRetention references missing role "${E.formerRoleKey}".`));for(let v of e.searchFilters??[]){(v.kind==="chips"||v.kind==="select")&&(v.options?.length??0)===0&&t.push(`Search filter "${v.key}" must define options.`),(v.kind==="text"||v.kind==="numberRange")&&v.target===void 0&&t.push(`Search filter "${v.key}" must define a target field.`),v.options!==void 0&&En(v.options.map(P=>P.key),`search filter option for "${v.key}"`,t),ih(v.target,c,t,`Search filter "${v.key}"`);for(let P of v.options??[]){P.predicates.length===0&&t.push(`Search filter option "${v.key}.${P.key}" must define at least one predicate.`);for(let A of P.predicates){if(A.kind==="role"){l.has(A.roleKey)||t.push(`Search filter option "${v.key}.${P.key}" references missing role "${A.roleKey}".`);continue}ih(A,c,t,`Search filter option "${v.key}.${P.key}"`)}}}for(let v of e.partyResultIcons??[])fQ(v,c,t);for(let v of e.foundation.legalEntities)if(v.terms!==void 0&&t.push(...zb(v.terms,`foundation.legalEntities.${v.key}.terms`)),qL(v.branding,t,`foundation.legalEntities.${v.key}.branding`),KL(v,t,`foundation.legalEntities.${v.key}`),v.signatoryUserKey!==void 0&&v.type==="school_group"&&t.push(`[config/signatoryOnGroup] Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) declares an Unterschriftsperson.`),v.parentLegalEntityKey&&!u.has(v.parentLegalEntityKey)&&t.push(`Legal entity "${v.key}" references missing parent "${v.parentLegalEntityKey}".`),v.address!==void 0){let P=v.address,A=["street","hausnr","plz","ort"];v.type==="school_group"?t.push(`Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) has an address.`):(typeof P!="object"||P===null||Array.isArray(P)||Object.keys(P).some(M=>!A.includes(M))||A.some(M=>typeof P[M]!="string"||(P[M]??"").trim()===""))&&t.push(`Legal entity "${v.key}" has an invalid address \u2014 expected { street, hausnr, plz, ort }, each non-empty.`)}let $=new Map;for(let v of e.foundation.units){if(v.slug!==void 0){let P=typeof v.slug=="string"?wO(v.slug):"must be a string";P!==void 0&&t.push(`Unit "${v.key}" has invalid slug "${v.slug}" (${P}).`);let A=$.get(v.slug);A!==void 0&&t.push(`Units "${A}" and "${v.key}" both declare slug "${v.slug}" (unit slugs are unique per tenant).`),$.set(v.slug,v.key)}u.has(v.legalEntityKey)||t.push(`Unit "${v.key}" references missing legal entity "${v.legalEntityKey}".`),v.parentUnitKey&&!p.has(v.parentUnitKey)&&t.push(`Unit "${v.key}" references missing parent unit "${v.parentUnitKey}".`),v.sortOrder!==void 0&&(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Unit "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`)}let C=/^[0-9a-f]{32}:[0-9a-f]{128}$/;for(let v of e.foundation.users){h.has(v.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${v.permissionGroupKey}".`),v.unitKey&&!p.has(v.unitKey)&&t.push(`User "${v.email}" references missing unit "${v.unitKey}".`),v.status!==void 0&&v.status!=="deactivated"&&t.push(`User "${v.email}": status must be "deactivated" or absent, not "${String(v.status)}".`);let P=[v,...v.additionalMemberships??[]];for(let M of v.additionalMemberships??[])h.has(M.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${M.permissionGroupKey}".`),M.unitKey&&!p.has(M.unitKey)&&t.push(`User "${v.email}" references missing unit "${M.unitKey}".`);En(P.map(M=>`${M.permissionGroupKey}/${M.unitKey??""}`),`membership (permission group/unit) of user "${v.email}"`,t);for(let M of P)M.validFrom!==void 0&&M.validTo!==void 0&&M.validTo<=M.validFrom&&t.push(`User "${v.email}": membership "${M.permissionGroupKey}" ends (validTo) before it starts (validFrom).`);let A=[v.firstName,v.lastName];A.some(M=>M!==void 0)&&A.some(M=>typeof M!="string"||M.trim()==="")&&t.push(`[config/userNameIncomplete] User "${v.email}" states only part of firstName/lastName (or an empty one) \u2014 set both or neither.`);for(let M of["staging","prod"]){let U=v.passwordHashes?.[M];U!==void 0&&!C.test(U)&&t.push(`User "${v.email}" passwordHashes.${M} is not in Better Auth scrypt format "<32hex>:<128hex>".`)}}qL(e.tenant.branding,t),KL(e.tenant,t);let L=BL(e.fields.flatMap(v=>v.sourceColumns));for(let v of L)r.push(`Source column "${v}" is mapped by more than one field.`);kQ(e,t);let _=n.sourceColumns===void 0||e.source===void 0?void 0:yQ(e,n.sourceColumns,t);return{ok:t.length===0,errors:t,warnings:r,coverage:_}}s(jL,"validateTenantConfig");function lQ(e,n){let t=new Map;for(let r of e.objectSchema?.properties??[]){let i=r.addressPart;if(i===void 0)continue;let o=`Object property "${e.key}.${r.key}"`;if(!Jw.includes(i)){n.push(`${o}: addressPart "${i}" is none of ${Jw.join(", ")}.`);continue}e.type!=="object"&&n.push(`${o}: only an object field stores an address (addressPart).`),r.type!=="string"&&n.push(`${o}: addressPart "${i}" needs a string property, not "${r.type}".`);let a=t.get(i);a!==void 0&&n.push(`${o}: addressPart "${i}" is already declared by "${e.key}.${a}".`),t.set(i,r.key)}}s(lQ,"validateAddressParts");function dQ(e,n){let t=e.relationshipKinds;if(t===void 0)return;if(e.type!=="relationship"){n.push(`Field "${e.key}" declares relationshipKinds, but only a relationship field carries them.`);return}let r=new Map((e.objectSchema?.properties??[]).map(i=>[i.key,i]));for(let i of t){let o=`Field "${e.key}" relationship kind "${i.key}"`;if(typeof i.key!="string"||i.key.trim()===""){n.push(`Field "${e.key}": a relationship kind needs a key.`);continue}for(let l of["de","en"])(i.label?.[l]??"").trim()===""&&n.push(`${o}: label.${l} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);if(i.edge===null||typeof i.edge!="object"||Array.isArray(i.edge)){n.push(`${o}: edge must be an object.`);continue}i.sibling!==void 0&&i.sibling!==!0&&n.push(`${o}: sibling must be true or absent.`),i.sibling===!0&&i.mergeInto!==void 0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare mergeInto.`);let a=t.flatMap(l=>l.mergeInto!==void 0?[l.mergeInto]:[]);if(i.sibling===!0&&a.some(l=>l in i.edge)&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare a property another kind of the field merges into.`),i.sibling===!0&&Object.keys(i.edge).length===0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 an empty edge would count every edge of the field.`),i.mergeInto!==void 0){let l=r.get(i.mergeInto);l===void 0||l.type!=="0-n-select"?n.push(`${o}: mergeInto "${i.mergeInto}" must name a 0-n-select property of the field's objectSchema.`):Array.isArray(i.edge[i.mergeInto])||n.push(`${o}: mergeInto "${i.mergeInto}" must be set to a list in the edge.`)}}}s(dQ,"validateRelationshipKinds");function cQ(e,n,t){if(e.autoString===void 0){t.push(`Automatic field "${e.key}" must define autoString.`);return}e.allowMultiple===!0&&t.push(`Automatic field "${e.key}" must not allow multiple values.`),e.shareable===!0&&t.push(`Automatic field "${e.key}" must not be shareable.`),e.autoString.segments.length===0&&t.push(`Automatic field "${e.key}" must define at least one segment.`),e.autoString.segments.filter(i=>i.kind==="sequence").length!==1&&t.push(`Automatic field "${e.key}" must define exactly one sequence segment.`);for(let i of e.autoString.segments)if(i.kind==="literal"&&i.value.length===0&&t.push(`Automatic field "${e.key}" has an empty literal segment.`),i.kind==="sequence"&&(i.startAt!==void 0&&(!Number.isInteger(i.startAt)||i.startAt<1)&&t.push(`Automatic field "${e.key}" sequence startAt must be an integer >= 1.`),i.minDigits!==void 0&&(!Number.isInteger(i.minDigits)||i.minDigits<0)&&t.push(`Automatic field "${e.key}" sequence minDigits must be an integer >= 0.`)),i.kind==="field"){let o=n.get(i.fieldKey);if(o===void 0){t.push(`Automatic field "${e.key}" references missing field "${i.fieldKey}".`);continue}i.objectPropertyKey!==void 0&&o.objectSchema?.properties.find(l=>l.key===i.objectPropertyKey)===void 0&&t.push(`Automatic field "${e.key}" references missing object property "${i.fieldKey}.${i.objectPropertyKey}".`)}}s(cQ,"validateAutomaticStringField");function ih(e,n,t,r){if(e===void 0)return;let i=n.get(e.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.fieldKey}".`);return}if(e.objectPropertyKey===void 0)return;(i.objectSchema?.properties.some(a=>a.key===e.objectPropertyKey)??!1)||t.push(`${r} references missing object property "${e.fieldKey}.${e.objectPropertyKey}".`)}s(ih,"validateSearchTarget");function uQ(e,n,t){if(e.source.kind!=="relationshipTargetField")return;let r=`Template placeholder "${e.key}"`,i=n.get(e.source.relationshipFieldKey);if(i===void 0)t.push(`${r} references missing relationship field "${e.source.relationshipFieldKey}".`);else if(i.type!=="relationship")t.push(`${r} relationship field "${e.source.relationshipFieldKey}" must be a relationship field.`);else{for(let a of e.source.edgeFilters??[])Qb(i,a.propertyKey,t,`${r} edge filter`);e.source.selection?.sortPropertyKey!==void 0&&Qb(i,e.source.selection.sortPropertyKey,t,`${r} selection sort`)}let o=n.get(e.source.targetFieldKey);if(o===void 0){t.push(`${r} references missing target field "${e.source.targetFieldKey}".`);return}o.type==="relationship"&&t.push(`${r} target field "${e.source.targetFieldKey}" must not be a relationship field.`),e.source.targetObjectPropertyKey!==void 0&&Qb(o,e.source.targetObjectPropertyKey,t,`${r} target`)}s(uQ,"validateRelationshipTemplatePlaceholder");function Qb(e,n,t,r){(e.objectSchema?.properties.some(o=>o.key===n)??!1)||t.push(`${r} references missing object property "${e.key}.${n}".`)}s(Qb,"validateObjectPropertyReference");function fQ(e,n,t){let r=`Party result icon "${e.key}"`,i=n.get(e.when.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.when.fieldKey}".`);return}if(e.when.objectPropertyKey===void 0){i.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`);return}let o=i.objectSchema?.properties.find(a=>a.key===e.when.objectPropertyKey);if(o===void 0){t.push(`${r} references missing object property "${e.when.fieldKey}.${e.when.objectPropertyKey}".`);return}o.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`)}s(fQ,"validatePartyResultIconTarget");function VL(e){return`${e.templateId}:${e.locale}:${e.scopeKey}`}s(VL,"letterIdentity");function pQ(e){return`${e.generatorKey??"*"}/${e.partyKind}/${e.roleKey}`}s(pQ,"contractRoleMappingIdentity");function mQ(e,n,t){let r=new Set;for(let i of e){let o=pQ(i),a=`Contract role mapping "${o}"`;qb.includes(i.partyKind)||t.push(`${a}: partyKind must be one of ${qb.join(", ")}.`),i.partyKind==="beneficiary"&&t.push(`${a}: a beneficiary holds the enrollee role of the program it attends (programs.enrolleeRoleKey, else tenant.defaultEnrolleeRoleKey) \u2014 remove the mapping.`),n.has(i.roleKey)||t.push(`${a} references missing role "${i.roleKey}".`),i.generatorKey!==void 0&&i.generatorKey.trim()===""&&t.push(`${a}: generatorKey must not be blank \u2014 omit it for the tenant default.`),r.has(o)&&t.push(`${a} is declared twice.`),r.add(o)}}s(mQ,"validateContractRoleMappings");function hQ(e,n){for(let t of e){let r=`Notification letter "${VL(t)}"`;if(!Zm(t.locale)){n.push(`${r} declares locale "${String(t.locale)}" \u2014 letters are written in ${Be.map(i=>`"${i}"`).join(" and ")} only, so no mail would ever read this deviation.`);continue}if(t.scopeKey!==Jm){n.push(`${r} declares scopeKey "${t.scopeKey}" \u2014 the only scope is "${Jm}" (the whole school).`);continue}if(Object.keys(t.slots).length===0){n.push(`${r} overrides no block. A deviation that deviates in nothing is not an entry \u2014 remove it.`);continue}if(!Rk(t.templateId)){n.push(`${r} references no registered letter \u2014 "${t.templateId}" is not in the letter catalog.`);continue}for(let i of xL(Tk(t.templateId),t.slots,t.locale))n.push(`${r}, block "${i.slotKey}" [${i.code}]: ${i.message.de}`)}}s(hQ,"validateNotificationLetters");function gQ(e,n){if(e!==void 0)for(let t of SL(e))n.push(`Notification chrome: ${t.de}`)}s(gQ,"validateNotificationChrome");function qL(e,n,t){if(e===void 0)return;let r=t===void 0?n:{push:s((...p)=>n.push(...p.map(h=>`${t}: ${h}`)),"push")},i=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,o=/^(?:rgb|rgba|hsl|hsla)\(.+\)$/i,a=s(p=>i.test(p.trim())||o.test(p.trim()),"isColor");for(let[p,h]of Object.entries(e.colors??{}))h!==void 0&&(a(h)||r.push(`Branding color "colors.${p}" has invalid value "${h}" (expected hex "#rgb"/"#rrggbb"/"#rrggbbaa" or rgb()/rgba()/hsl()/hsla()).`));let l=["sharp","rounded","soft"];e.radius!==void 0&&!l.includes(e.radius)&&r.push(`Branding radius "${e.radius}" is invalid (expected "sharp", "rounded", or "soft").`);let d=["sm","md","lg","max"];e.logoSize!==void 0&&!d.includes(e.logoSize)&&r.push(`Branding logoSize "${e.logoSize}" is invalid (expected "sm", "md", "lg", or "max").`);let c=["compact","normal","spacious"];e.bannerDensity!==void 0&&!c.includes(e.bannerDensity)&&r.push(`Branding bannerDensity "${e.bannerDensity}" is invalid (expected "compact", "normal", or "spacious").`);let u=["light","dark"];e.logoGround!==void 0&&!u.includes(e.logoGround)&&r.push(`Branding logoGround "${e.logoGround}" is invalid (expected "light" or "dark").`),e.websiteUrl!==void 0&&!e.websiteUrl.startsWith("https://")&&r.push(`Branding websiteUrl must be an https:// URL (got "${e.websiteUrl}").`);for(let p of["heading","body"]){let h=e.fonts?.[p];h!==void 0&&((typeof h.family!="string"||h.family.trim().length===0)&&r.push(`Branding font "fonts.${p}" must define a non-empty family.`),Object.hasOwn(h,"url")&&r.push(`Branding font "fonts.${p}.url" is no longer supported \u2014 the font file is uploaded (plexus-cli branding set-font --slot ${p} --file <woff2>) and config carries the family only.`))}}s(qL,"validateBranding");function KL(e,n,t="tenant"){let r=e.brandingAssets;if(r!==void 0){if(typeof r!="object"||r===null||Array.isArray(r)){n.push(`${t}.brandingAssets must be an object keyed by slot (${nh.join(", ")}).`);return}for(let[i,o]of Object.entries(r)){let a=`${t}.brandingAssets.${i}`;if(!nh.includes(i)){n.push(`${a}: unknown slot (expected ${nh.join(", ")}).`);continue}if(typeof o!="object"||o===null){n.push(`${a}: must be { sha256, sizeBytes, mimeType }.`);continue}if("size"in o){n.push(`[config/fileRefRenamed] ${a} still names size \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}UL.test(o.sha256??"")||n.push(`${a}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(o.sizeBytes)||o.sizeBytes<=0)&&n.push(`${a}: sizeBytes must be a positive integer.`);let l=TL[i];if(l===null){let d=RL({contentType:o.mimeType,size:o.sizeBytes});d!==null&&n.push(`${a}: ${d.de}`)}else{o.mimeType!==Hb&&n.push(`${a}: mimeType must be "${Hb}" (got "${o.mimeType}").`);let d=$L(e.branding?.fonts?.[l]?.family);d!==null&&n.push(`${a}: [branding/fontFamilyMissing] ${t}.branding.fonts.${l}: ${d.de}`)}"path"in o&&n.push(`${a}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}}s(KL,"validateBrandingAssets");function yQ(e,n,t){let{source:r}=e;r===void 0&&F("validateSourceCoverage: called without a `source` block.");let i=new Set(n),o=new Set(e.fields.flatMap(k=>k.sourceColumns)),a=new Set(e.deferredColumns.map(k=>k.column)),l=new Set(e.ignoredColumns.map(k=>k.column)),d=new Set([...o,...a,...l]),c=r.requiredColumns.filter(k=>!i.has(k)),u=n.filter(k=>!d.has(k)),p=[...o].filter(k=>!i.has(k)),h=[...a].filter(k=>!i.has(k)),y=[...l].filter(k=>!i.has(k));for(let k of c)t.push(`Required source column "${k}" is missing from ${r.primaryTable}.`);for(let k of u)t.push(`Source column "${k}" is neither mapped nor explicitly deferred/ignored.`);for(let k of p)t.push(`Mapped source column "${k}" does not exist in the source schema.`);for(let k of h)t.push(`Deferred source column "${k}" does not exist in the source schema.`);for(let k of y)t.push(`Ignored source column "${k}" does not exist in the source schema.`);return{table:r.primaryTable,availableColumns:n.length,mappedColumns:[...o].filter(k=>i.has(k)).length,deferredColumns:[...a].filter(k=>i.has(k)).length,ignoredColumns:[...l].filter(k=>i.has(k)).length,missingRequiredColumns:c,unmappedColumns:u,unknownMappedColumns:p,unknownDeferredColumns:h,unknownIgnoredColumns:y}}s(yQ,"validateSourceCoverage");function En(e,n,t){for(let r of BL(e))t.push(`Duplicate ${n} key "${r}".`)}s(En,"requireUnique");function BL(e){let n=new Set,t=new Set;for(let r of e)n.has(r)&&t.add(r),n.add(r);return[...t]}s(BL,"duplicates");var UL=/^[0-9a-f]{64}$/,wQ=["fileName","size"];function kQ(e,n){if(!Array.isArray(e.files)){n.push('"files" is missing \u2014 declare the file library (an empty list is fine).');return}En(e.files.map(t=>t.key),"file",n);for(let t of e.files){let r=`files["${t.key}"]`;ja(t.key)||n.push(`${r}: key must match ${hb}.`);for(let o of["de","en"])(t.label?.[o]??"").trim()===""&&n.push(`${r}: label.${o} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);let i=wQ.filter(o=>o in t);if(i.length>0){n.push(`[config/fileRefRenamed] ${r} still names ${i.join(", ")} \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now filename / sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}if(typeof t.filename!="string")n.push(`${r}: filename is missing.`);else{let o=ls(t.filename);o!==null&&n.push(`${r}: filename ${o}.`)}Qm.includes(t.mimeType)||n.push(`${r}: mimeType "${t.mimeType}" is not allowed (${Qm.join(", ")}).`),UL.test(t.sha256??"")||n.push(`${r}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(t.sizeBytes)||t.sizeBytes<=0)&&n.push(`${r}: sizeBytes must be a positive integer.`),"path"in t&&n.push(`${r}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}s(kQ,"validateFiles");var bQ=new WeakMap,vQ=new WeakSet;function Zb(e,n){n(e);let r=e.asOptional.bind(e);return Object.defineProperty(e,"asOptional",{value:s(()=>Zb(r(),n),"value"),enumerable:!1}),e}s(Zb,"carry");function Ya(e,n){return Zb(e,t=>bQ.set(t,n))}s(Ya,"tagged");var xQ="tenant teardown drains every table explicitly (config/wipe.ts)",Ue={belongsTo:s(e=>Ya(e,{kind:"belongsTo"}),"belongsTo"),owns:s(e=>Ya(e,{kind:"owns"}),"owns"),holds:s(e=>Ya(e,{kind:"holds"}),"holds"),restrict:s((e,n)=>Ya(e,n?{kind:"restrict",unindexed:n.unindexed}:{kind:"restrict"}),"restrict"),history:s(e=>Ya(e,{kind:"history"}),"history"),tenant:s(e=>Ya(e,{kind:"restrict",unindexed:xQ}),"tenant"),historyOf:s(e=>Zb(e,n=>vQ.add(n)),"historyOf")};var SQ=m.object({street:m.string(),hausnr:m.string(),plz:m.string(),ort:m.string()}),GL=m.union(m.literal("school_operator"),m.literal("school_group"),m.literal("service_entity")),oi=GL.members.map(e=>e.value),AQ={tenantId:Ue.tenant(m.id("tenants")),name:m.optional(m.string()),type:GL,parentLegalEntityId:m.optional(Ue.restrict(m.id("legal_entities"))),configKey:m.optional(m.string()),partyId:m.optional(Ue.restrict(m.id("parties"))),address:m.optional(SQ),signatoryUserId:m.optional(Ue.restrict(m.id("users"))),terms:m.optional(bL)},v$e=Kt(AQ).index("by_tenantId",["tenantId"]).index("by_parentLegalEntityId",["parentLegalEntityId"]).index("by_tenantId_and_configKey",["tenantId","configKey"]).index("by_partyId",["partyId"]).index("by_signatoryUserId",["signatoryUserId"]);var EQ=m.union(m.literal("school"),m.literal("kindergarten"),m.literal("after_school_care"),m.literal("department"),m.literal("site"),m.literal("other")),zt=EQ.members.map(e=>e.value),A$e=m.union(m.literal("school"),m.literal("vocational"),m.literal("care"),m.literal("seminar"),m.literal("other")),E$e=m.union(m.literal("none"),m.literal("manual"),m.literal("annual_rollover")),T$e=m.union(m.literal("grade_level"),m.literal("module"),m.literal("phase"),m.literal("other")),R$e=m.union(m.literal("school_year"),m.literal("cohort"),m.literal("seminar"),m.literal("care_period"),m.literal("other")),$$e=m.union(m.literal("planned"),m.literal("active"),m.literal("completed"),m.literal("archived")),I$e=m.union(m.literal("class"),m.literal("course"),m.literal("care_group"),m.literal("seminar_group"),m.literal("mixed_age_group"),m.literal("other")),O$e=m.union(m.literal("planned"),m.literal("active"),m.literal("completed"),m.literal("cancelled")),_$e=m.union(m.literal("class_teacher"),m.literal("teacher"),m.literal("mentor"),m.literal("instructor"),m.literal("assistant"),m.literal("other")),P$e=m.union(m.literal("units"),m.literal("unit_profiles"),m.literal("programs"),m.literal("program_stages"),m.literal("program_runs"),m.literal("learning_groups"),m.literal("enrollments"),m.literal("learning_group_staff_assignments")),N$e=m.union(m.literal("open"),m.literal("mapped"),m.literal("ignored"));function WL(e){let n=["street","hausnr","plz","ort"].filter(t=>e[t]!==void 0);if(n.length!==0){if(n.length!==4)throw new Error(`config legal-entity add: an address needs all of --street, --hausnr, --plz and --ort (got ${n.map(t=>`--${t}`).join(", ")})`);return{street:e.street,hausnr:e.hausnr,plz:e.plz,ort:e.ort}}}s(WL,"addressFrom");function YL(e){if(!oi.includes(e))throw new Error(`config legal-entity add: --type "${e}" is none of ${oi.join(", ")}`);return e}s(YL,"legalEntityType");function HL(e){if(!zt.includes(e))throw new Error(`config unit add: --kind "${e}" is none of ${zt.join(", ")}`);return e}s(HL,"unitKind");function JL(e,n,t){let r=e.find(i=>i.key===n.key);if(r===void 0)return e.push(n),"create";if(Pe(r)===Pe(n))return"same";throw new Error(`${t} "${n.key}" already exists with other values \u2014 decide by hand, nothing written.
|
|
11626
11626
|
in the file: ${JSON.stringify(r)}
|
|
11627
11627
|
requested: ${JSON.stringify(n)}`)}s(JL,"addRow");function zL(e){return new Set(jL(e).errors)}s(zL,"findings");function QL(e,n){let t=s(()=>JSON.parse(he(e,"utf8")),"read"),r=t();if(typeof r!="object"||r===null||typeof r.foundation!="object")throw new Error(`config: ${e} is no exported tenant config (no "foundation" block) \u2014 export one with \`config export --out <file>\``);let i=zL(r),o=t(),a=n(o),l=[...zL(o)].filter(d=>!i.has(d));if(l.length>0)throw new Error(`config: the edit is refused by the config validator, nothing written:
|
|
11628
11628
|
${l.join(`
|
|
@@ -11646,7 +11646,7 @@ The Plexus team`}},v5={de:{...Fd.de,closing:null},en:{...Fd.en,closing:null}};va
|
|
|
11646
11646
|
`)+`\r
|
|
11647
11647
|
`}s(jQ,"linksCsv");function VQ(e,n){if(e.to===void 0==(e.from===void 0))throw new Error("demo link create: give exactly one of --to <name> or --from <recipients.csv>.");if(e.from!==void 0){if(e.email!==void 0)throw new Error("demo link create: --email goes with --to, not --from.");return qQ(MQ(n(e.from),e.from))}return[{name:e.to,...e.email!==void 0?{email:e.email}:{}}]}s(VQ,"recipientsOf");async function BQ(e,n,t=r=>CQ(r)){return await e.mutation(x.demoLinks.createLinks,{recipients:VQ(n,t),...n.video!==void 0?{videoId:n.video}:{},...n.campaign!==void 0?{campaign:n.campaign}:{},...n.note!==void 0?{note:n.note}:{}})}s(BQ,"createLinksRun");async function g0(e,n){let{rows:t}=await Uf(e,x.demoLinks.listLinks,n===void 0?{}:{campaign:n},{pageSize:200});return t}s(g0,"allLinks");function Rv(e){return e.map(n=>({empf\u00E4nger:n.recipientName,email:n.recipientEmail??"\u2014",video:n.videoId??"(alle)",kampagne:n.campaign??"\u2014",url:n.url,...n.revokedAt!==void 0?{widerrufen:bv(n.revokedAt)}:{}}))}s(Rv,"linkRows");function UQ(e){return e.pages.length===0?"\u2014":e.pages.map(n=>`${h0(n.path).de} ${dh(n.activeSeconds)} (${n.views}\xD7)`).join(" \xB7 ")}s(UQ,"pagesText");function GQ(e){return e.flatMap(n=>{let t={empf\u00E4nger:n.recipientName,code:n.code,besuche:String(n.visits),erster:bv(n.firstVisitAt),letzter:bv(n.lastVisitAt),seiten:UQ(n)};return n.videos.length===0?[{...t,video:n.videoId??"\u2014",gesehen:"\u2014","%":"\u2014"}]:n.videos.map(r=>({...t,video:r.videoId,gesehen:`${dh(r.watchedSeconds)} / ${dh(r.durationSeconds)}`,"%":`${r.percent} %`}))})}s(GQ,"statsRows");var vv=class extends N{static{s(this,"DemoVideosCommand")}static paths=[["demo","videos"]];static usage=R.Usage({category:"Marketing",description:"List the demo video catalogue (the ids a demo link can point at).",examples:[["List the videos","plexus-cli demo videos"]]});async execute(){let t=await(await this.caller()).query(x.demoLinks.listVideos,{});return this.print(t,r=>r.map(i=>({id:i.id,datum:i.date,titel:i.title.de,dauer:dh(i.durationSeconds)})),["id","datum","titel","dauer"]),0}},xv=class extends N{static{s(this,"DemoLinkCreateCommand")}static paths=[["demo","link","create"]];static usage=R.Usage({category:"Marketing",description:"Create personalised demo video links (one recipient, or a CSV). Needs _platform.demoLinks.manage.",details:`Each link belongs to one named recipient and, with --video, jumps to that video; without it the link opens the whole page. A visit counts once the page was visible for 5 s or the visitor interacted \u2014 a mail scanner that only fetches the link does not count. --from reads a UTF-8 CSV ("," or ";") with a header row: name, optional email (or E-Mail), optional video (a row's video wins over --video). The batch is created all or nothing. --out writes the links as a ";" CSV that German Excel opens directly.`,examples:[["One recipient, one video",'plexus-cli demo link create --to "Erika Mustermann" --video vorlagen --env prod --allow-prod'],["A CSV batch, result as CSV","plexus-cli demo link create --from recipients.csv --campaign herbst --out links.csv --env prod --allow-prod"]]});to=f.String("--to",{description:"The recipient's name."});email=f.String("--email",{description:"The recipient's email address (with --to)."});from=f.String("--from",{description:"UTF-8 CSV of recipients: name, email, video."});video=f.String("--video",{description:"Video id (see `demo videos`); without it the whole page."});campaign=f.String("--campaign",{description:"Campaign label, to list and count links together."});note=f.String("--note",{description:"Free note kept with the links."});out=f.String("--out",{description:"Also write the created links as CSV to this file (refused when it exists, unless --force)."});force=bn();async execute(){let n=this.out===void 0?void 0:Kn(this.out,this.force),t=await this.caller(),r=await BQ(t,{to:this.to,email:this.email,from:this.from,video:this.video,campaign:this.campaign,note:this.note});return this.print(r,Rv,["empf\xE4nger","email","video","kampagne","url"]),n!==void 0&&DQ(n,jQ(r)),0}},Sv=class extends N{static{s(this,"DemoLinkListCommand")}static paths=[["demo","link","list"]];static usage=R.Usage({category:"Marketing",description:"List demo links, newest first. Needs _platform.demoLinks.manage."});campaign=f.String("--campaign",{description:"Only this campaign."});async execute(){let n=await this.caller();return this.print(await g0(n,this.campaign),Rv,["empf\xE4nger","email","video","kampagne","url","widerrufen"]),0}},Av=class extends N{static{s(this,"DemoLinkStatsCommand")}static paths=[["demo","link","stats"]];static usage=R.Usage({category:"Marketing",description:"Who opened their demo link, when, how often, how long per video and per demo page. Needs _platform.demoLinks.manage.",details:"besuche = page loads a person engaged with (visible 5 s or an interaction); erster/letzter = first and latest visit (Europe/Berlin); gesehen = seconds actually played, summed over visits, / video length; % = how much of the video the best single visit actually played (skipping ahead does not count); seiten = per demo page the time it was visible, summed over visits (mm:ss), and how many visits viewed it \u2014 a page counts after 5 s visible or an interaction there.",examples:[["One link","plexus-cli demo link stats k7m2q9xdp3ab --env prod"],["A campaign","plexus-cli demo link stats --campaign herbst --env prod"]]});code=f.String({required:!1,name:"code"});campaign=f.String("--campaign",{description:"Only this campaign (not together with a code)."});async execute(){if(this.code!==void 0&&this.campaign!==void 0)throw new Error("demo link stats: either a code or --campaign, not both.");let n=await this.caller(),t=this.code===void 0?await g0(n,this.campaign):[await n.query(x.demoLinks.getLink,{code:this.code})];return this.print(t,GQ,["empf\xE4nger","code","video","besuche","erster","letzter","seiten","gesehen","%"]),0}},Ev=class extends N{static{s(this,"DemoLinkRevokeCommand")}static paths=[["demo","link","revoke"]];static usage=R.Usage({category:"Marketing",description:"Stop recording for a demo link \u2014 plan unless --confirm; the page keeps working and its statistics stay. Needs _platform.demoLinks.manage."});code=f.String({required:!0,name:"code"});confirm=f.Boolean("--confirm",!1,{description:"Revoke (without it, only the plan is printed)."});async execute(){let n=await this.caller();if(!this.confirm){let r=await n.query(x.demoLinks.getLink,{code:this.code});return this.context.stdout.write(`Would stop recording for the link of ${r.recipientName} (${r.code}). Re-run with --confirm.
|
|
11648
11648
|
`),0}let t=await n.mutation(x.demoLinks.revokeLink,{code:this.code});return this.print([t],Rv,["empf\xE4nger","video","url","widerrufen"]),0}},Tv=class extends N{static{s(this,"DemoLinkDeleteCommand")}static paths=[["demo","link","delete"]];static usage=R.Usage({category:"Marketing",description:"Erase a demo link: the recipient's name and address and everything recorded for it. Needs _platform.demoLinks.manage.",details:"Without --confirm it only shows what would be deleted. The deletion cannot be undone; the page keeps working for anyone who still has the link, and records nothing.",examples:[["Erase on request","plexus-cli demo link delete k7m2q9xdp3ab --confirm --env prod --allow-prod"]]});code=f.String({required:!0,name:"code"});confirm=f.Boolean("--confirm",!1,{description:"Really delete."});async execute(){let n=await this.caller();if(!this.confirm){let r=await n.query(x.demoLinks.getLink,{code:this.code});return this.context.stdout.write(`Would delete the link of ${r.recipientName} (${r.code}) with ${r.visits} visit(s). Re-run with --confirm.
|
|
11649
|
-
`),0}let t=await n.mutation(x.demoLinks.deleteLink,{code:this.code});return this.print(t,r=>[{gel\u00F6scht:r.code,empf\u00E4nger:r.recipientName}]),0}},y0=[vv,xv,Sv,Av,Ev,Tv];var ps=["offen","todo","bearbeitung","klaerung","abgeschlossen","spaeter"],zQ=m.union(m.literal("offen"),m.literal("todo"),m.literal("bearbeitung"),m.literal("klaerung"),m.literal("abgeschlossen"),m.literal("spaeter")),WQ=zQ,YQ=m.union(m.literal("open"),m.literal("closed")),HQ=m.union(m.literal("completed"),m.literal("not_planned"),m.literal("reopened"),m.literal("duplicate"),m.null()),JQ=m.object({repo:m.string(),number:m.number(),url:m.string(),state:YQ,stateReason:m.optional(HQ),linkedAt:m.number(),lastSyncedAt:m.number()}),QQ=m.object({pathname:m.string(),search:m.string(),hash:m.string(),pageTitle:m.string(),selectedUnit:m.optional(m.object({id:m.string(),unitId:m.optional(Ue.history(m.id("units"))),label:m.string(),kind:m.union(m.literal("tenant"),m.literal("unit"))})),viewport:m.object({width:m.number(),height:m.number(),devicePixelRatio:m.number()}),locale:m.string(),timezone:m.string()}),ZQ={tenantId:Ue.tenant(m.id("tenants")),userId:Ue.history(m.id("users")),summary:m.string(),situation:m.optional(m.string()),goal:m.optional(m.string()),needToSee:m.optional(m.string()),needToDo:m.optional(m.string()),reason:m.optional(m.string()),currentWorkaround:m.optional(m.string()),status:WQ,boardRank:m.number(),context:QQ,screenshotStorageId:m.optional(Ue.owns(m.id("_storage"))),githubIssue:m.optional(JQ),githubIssueKey:m.optional(m.string()),deadline:m.optional(m.number()),assigneeUserId:m.optional(Ue.restrict(m.id("users"),{unindexed:"only by_status_and_assignee, which leads with status"})),lastActivityAt:m.number(),openReplaySessionURL:m.optional(m.string())},
|
|
11649
|
+
`),0}let t=await n.mutation(x.demoLinks.deleteLink,{code:this.code});return this.print(t,r=>[{gel\u00F6scht:r.code,empf\u00E4nger:r.recipientName}]),0}},y0=[vv,xv,Sv,Av,Ev,Tv];var ps=["offen","todo","bearbeitung","klaerung","abgeschlossen","spaeter"],zQ=m.union(m.literal("offen"),m.literal("todo"),m.literal("bearbeitung"),m.literal("klaerung"),m.literal("abgeschlossen"),m.literal("spaeter")),WQ=zQ,YQ=m.union(m.literal("open"),m.literal("closed")),HQ=m.union(m.literal("completed"),m.literal("not_planned"),m.literal("reopened"),m.literal("duplicate"),m.null()),JQ=m.object({repo:m.string(),number:m.number(),url:m.string(),state:YQ,stateReason:m.optional(HQ),linkedAt:m.number(),lastSyncedAt:m.number()}),QQ=m.object({pathname:m.string(),search:m.string(),hash:m.string(),pageTitle:m.string(),selectedUnit:m.optional(m.object({id:m.string(),unitId:m.optional(Ue.history(m.id("units"))),label:m.string(),kind:m.union(m.literal("tenant"),m.literal("unit"))})),viewport:m.object({width:m.number(),height:m.number(),devicePixelRatio:m.number()}),locale:m.string(),timezone:m.string()}),ZQ={tenantId:Ue.tenant(m.id("tenants")),userId:Ue.history(m.id("users")),summary:m.string(),situation:m.optional(m.string()),goal:m.optional(m.string()),needToSee:m.optional(m.string()),needToDo:m.optional(m.string()),reason:m.optional(m.string()),currentWorkaround:m.optional(m.string()),status:WQ,boardRank:m.number(),context:QQ,screenshotStorageId:m.optional(Ue.owns(m.id("_storage"))),githubIssue:m.optional(JQ),githubIssueKey:m.optional(m.string()),deadline:m.optional(m.number()),assigneeUserId:m.optional(Ue.restrict(m.id("users"),{unindexed:"only by_status_and_assignee, which leads with status"})),lastActivityAt:m.number(),openReplaySessionURL:m.optional(m.string())},ZIe=Kt(ZQ).index("by_tenantId",["tenantId"]).index("by_tenantId_and_userId",["tenantId","userId"]).index("by_tenantId_and_status",["tenantId","status"]).index("by_github_issue",["githubIssueKey"]).index("by_status_and_rank",["status","boardRank"]).index("by_tenantId_and_status_and_rank",["tenantId","status","boardRank"]).index("by_tenantId_and_userId_and_status",["tenantId","userId","status"]).index("by_status_and_deadline",["status","deadline"]).index("by_status_and_assignee",["status","assigneeUserId"]).index("by_screenshotStorageId",["screenshotStorageId"]);import*as ch from"node:child_process";function w0(e){return new Proxy(e,{apply(n,t,r){if(cn())throw new Error("plexus: this command requires a local machine and cannot run in a platform chat.");return Reflect.apply(n,t,r)}})}s(w0,"localOnly");var k0=w0(ch.spawnSync),$v=w0(ch.execFileSync);var Iv="SmartKomm/plexus",v0="feedback",uh=["bug","feature","task"],XQ={bug:"d73a4a",feature:"0e8a16",task:"1d76db"};function fh(e){return Math.trunc(e.number)}s(fh,"issueNumber");function x0(...e){try{return $v("gh",e,{encoding:"utf8"}).trim()}catch(n){throw new Error(`gh ${e.join(" ")} failed: ${at(n)}`,{cause:n})}}s(x0,"gh");function Ov(e){try{return{ok:!0,stdout:$v("gh",e,{encoding:"utf8"}),stderr:""}}catch(n){let t=n;return{ok:!1,stdout:t.stdout?.toString()??"",stderr:t.stderr?.toString()??""}}}s(Ov,"ghRaw");function S0(e,n){let t=(e||"").toUpperCase()==="CLOSED"?"closed":"open",r={COMPLETED:"completed",NOT_PLANNED:"not_planned",REOPENED:"reopened"}[(n||"").toUpperCase()];return{state:t,reason:r}}s(S0,"mapGhState");async function A0(e){try{let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status} ${n.statusText}`);return{bytes:new Uint8Array(await n.arrayBuffer()),contentType:n.headers.get("content-type")}}catch(n){throw new Error(`Could not download feedback screenshot: ${at(n)}`,{cause:n})}}s(A0,"downloadScreenshot");function E0(e,n,t){let{screenshotUrl:r,noScreenshot:i}=t;if(r!==void 0&&i)throw new Error("Pass either --screenshot-url or --no-screenshot, not both.");if(!n){if(r!==void 0)throw new Error(`Feedback ${e} has no screenshot \u2014 drop --screenshot-url.`);return null}if(i)return null;if(r===void 0)throw new Error(`Feedback ${e} has a screenshot. Save it with \`plexus-cli feedback screenshot ${e} --out <file>\`, upload it with your environment's upload tool as an EXPIRING (presigned) link \u2014 feedback screenshots can show customer data \u2014 and pass --screenshot-url <url>. Or file without it: --no-screenshot.`);let o;try{o=new URL(r)}catch{throw new Error(`--screenshot-url is not a URL: ${JSON.stringify(r)}`)}if(o.protocol!=="https:")throw new Error(`--screenshot-url must be https: ${JSON.stringify(r)}`);return o.href}s(E0,"screenshotForIssue");function T0(e){let n=new URL(e),t=n.hostname.split("."),r=t.indexOf("db");if(r===-1)throw new Error(`Cannot derive the app URL from convexUrl ${JSON.stringify(e)} (expected a 'db.' host label).`);return t.splice(r,1),`${n.protocol}//${t.join(".")}`}s(T0,"appBaseUrl");function R0(e,n,t){return`${e}/${n}/feedback?item=${encodeURIComponent(t)}`}s(R0,"feedbackItemUrl");function e8(e){let n=(e.name??"").trim(),t=(e.email??"").trim();return n&&t&&n!==t?`${n} (${t})`:t||n}s(e8,"reportedBy");function b0(e){return(e||"").split(`
|
|
11650
11650
|
`).map(n=>`> ${n}`).join(`
|
|
11651
11651
|
`)}s(b0,"blockquote");function $0(e,n){let t=`type:${n}`;return Ov(["label","create",t,"--repo",e,"--force","--color",XQ[n]]),t}s($0,"ensureTypeLabel");function I0(e){return`[${e.tags?.[0]?.name||"feedback"}] ${(e.summary||"").slice(0,80)}`}s(I0,"issueTitle");function O0(e,n,t){let r=["## Feedback",t,"",`Mandant **${e.tenantSlug}**`,`Gemeldet von: ${e8(e.submittedBy??{})}`,"","## Beschreibung",b0(e.summary??"")],i=[["Situation","situation"],["Ziel","goal"],["Ben\xF6tigte Information","needToSee"],["Ben\xF6tigte Aktion","needToDo"],["Grund","reason"],["Aktueller Workaround","currentWorkaround"]];for(let[o,a]of i){let l=e[a];typeof l=="string"&&l.length>0&&r.push("",`## ${o}`,b0(l))}return n&&r.push("","## Screenshot",``),r.filter(o=>o!==null).join(`
|
|
11652
11652
|
`)}s(O0,"issueBody");function Md(e){if(/^\d+$/.test(e))return Number.parseInt(e,10);let n=Date.parse(e);if(Number.isNaN(n))throw new Error(`Invalid date ${JSON.stringify(e)} \u2014 use ISO (e.g. 2026-06-20) or epoch ms.`);return n}s(Md,"parseDateMs");async function ph(e,n){if(n==="@me"||n==="me")return(await e.query(x.platformFeedback.whoAmI,{})).userId;if(!n.includes("@"))return n;let r=(await e.query(x.platformFeedback.listPlatformAdmins,{})).find(i=>i.email.toLowerCase()===n.toLowerCase());if(r===void 0)throw new Error(`No platform admin with email ${JSON.stringify(n)}.`);return r.userId}s(ph,"resolveAssigneeUserId");var qd=class extends N{static{s(this,"FeedbackListCommand")}static paths=[["feedback","list"]];static usage=R.Usage({category:"Feedback",description:"List feedback (active tenant, or --all-tenants for a platform admin)."});limit=f.String("--limit",{description:"Max rows (default 50)."});fetchAll=f.Boolean("--all",!1,{description:"Fetch every page."});allTenants=f.Boolean("--all-tenants",!1,{description:"Cross-tenant platform view (requires _platform.feedback.read)."});status=f.String("--status",{description:`Filter by status (${ps.join("|")}).`});withIssues=f.Boolean("--with-issues",!1,{description:"Only items linked to a GitHub issue."});withoutIssues=f.Boolean("--without-issues",!1,{description:"Only items NOT yet linked to a GitHub issue."});text=f.String("--text",{description:"Filter: summary or submitter name/email contains this text."});tagIds=f.Array("--tag",{description:"Filter: item carries any of these tag ids (repeatable)."});assignee=f.String("--assignee",{description:"Filter: assignee @me, userId, or email (platform; needs --all-tenants)."});deadlineFrom=f.String("--deadline-from",{description:"Filter: deadline >= ISO/epoch (platform; needs --all-tenants)."});deadlineTo=f.String("--deadline-to",{description:"Filter: deadline <= ISO/epoch (platform; needs --all-tenants)."});async execute(){let n=await this.caller(),t=this.limit===void 0?50:Number.parseInt(this.limit,10);if(Number.isNaN(t))throw new Error(`feedback list: --limit must be an integer, got "${this.limit}".`);let r=this.fetchAll?void 0:t,i=this.assignee||this.deadlineFrom||this.deadlineTo;if(!this.allTenants){if(this.withIssues||this.withoutIssues||i)throw new Error("--with-issues/--without-issues/--assignee/--deadline-* require --all-tenants (the GitHub link, assignee and deadline are platform-admin-only).");let d=this.requireTenant(n),c=await this.paginate(n,x.feedback.listTenant,{client:d},{max:r});return c=this.applyTextTagFilter(c),this.print(c),0}let o=this.parseStatus(),a={};o!==void 0&&(a.status=o),this.text!==void 0&&(a.text=this.text),this.tagIds&&this.tagIds.length>0&&(a.tagIds=this.tagIds),this.assignee!==void 0&&(a.assigneeUserId=await ph(n,this.assignee)),this.deadlineFrom!==void 0&&(a.deadlineFrom=Md(this.deadlineFrom)),this.deadlineTo!==void 0&&(a.deadlineTo=Md(this.deadlineTo));let l=await this.paginate(n,x.platformFeedback.listAllPlatform,a,{max:r});return this.withIssues&&(l=l.filter(d=>d.githubIssue)),this.withoutIssues&&(l=l.filter(d=>!d.githubIssue)),this.print(l,d=>d.map(n8),["id","tenant","status","tags","summary","issue","resolved"]),0}applyTextTagFilter(n){let t=this.text?.trim().toLowerCase(),r=this.tagIds&&this.tagIds.length>0?new Set(this.tagIds):null;return n.filter(i=>!(t&&!`${i.summary??""} ${i.submittedBy?.name??""} ${i.submittedBy?.email??""}`.toLowerCase().includes(t)||r&&!(i.tags??[]).some(o=>r.has(o.id))))}parseStatus(){if(this.status!==void 0){if(!ps.includes(this.status))throw new Error(`feedback list: --status must be one of ${ps.join("|")}.`);return this.status}}};function n8(e){let n=e.githubIssue;return{id:e.id,tenant:e.tenantSlug,status:e.status,tags:(e.tags??[]).map(t=>t.name).join(", "),summary:(e.summary??"").slice(0,50),issue:n?`#${fh(n)} (${n.state})`:"",resolved:e.resolved?"\u2713":""}}s(n8,"platformRow");var Kd=class extends N{static{s(this,"FeedbackToIssueCommand")}static paths=[["feedback","to-issue"]];static usage=R.Usage({category:"Feedback",description:"Create + link a GitHub issue for a feedback item (idempotent)."});feedbackId=f.String({required:!0,name:"feedbackId"});repo=f.String("--repo",Iv,{description:`Default ${Iv}.`});issueType=f.String("--type",{description:`Triage type (${uh.join("|")}) \u2014 added as a 'type:<t>' label.`});dryRun=f.Boolean("--dry-run",!1,{description:"Render the issue without creating it."});screenshotUrl=f.String("--screenshot-url",{description:"Hosted (expiring) link to the item's screenshot \u2014 required when the item has one. Save it with `feedback screenshot <id> --out <file>` first."});noScreenshot=f.Boolean("--no-screenshot",!1,{description:"File an item that has a screenshot without it."});async execute(){let n=await this.caller(),t=this.feedbackId,r=await n.query(x.platformFeedback.getById,{feedbackItemId:t}),i=r.githubIssue;if(i&&!this.dryRun)return this.print({feedbackId:this.feedbackId,issue:i.url,alreadyLinked:!0},w=>[{field:"feedbackId",value:w.feedbackId},{field:"issue",value:w.issue},{field:"alreadyLinked",value:"\u2713"}]),0;if(this.issueType!==void 0&&!uh.includes(this.issueType))throw new Error(`Invalid --type ${JSON.stringify(this.issueType)} \u2014 expected one of ${uh.join("|")}.`);let o=this.issueType,a=I0(r),l=R0(T0(n.convexUrl),r.tenantSlug,this.feedbackId),d=[v0,...o?[`type:${o}`]:[]],c=E0(this.feedbackId,!!r.screenshotUrl,{screenshotUrl:this.screenshotUrl,noScreenshot:this.noScreenshot}),u=O0(r,c,l);if(this.dryRun)return this.print({repo:this.repo,title:a,labels:d,hasScreenshot:!!r.screenshotUrl,screenshotUrl:c,body:u}),0;o&&$0(this.repo,o);let p=d.flatMap(w=>["--label",w]),h=x0("issue","create","--repo",this.repo,"--title",a,...p,"--body",u);if(!h.startsWith("https://github.com/"))throw new Error(`Unexpected gh output (not an issue URL): ${JSON.stringify(h)}`);let y=Number.parseInt(h.replace(/\/+$/,"").split("/").pop()??"",10);if(Number.isNaN(y))throw new Error(`Could not parse issue number from gh output: ${JSON.stringify(h)}`);let k=await n.mutation(x.platformFeedback.attachGithubIssue,{feedbackItemId:t,repo:this.repo,number:y,url:h,state:"open"});return this.print({feedbackId:this.feedbackId,issue:h,link:k},w=>[{field:"feedbackId",value:w.feedbackId},{field:"issue",value:w.issue}]),0}},jd=class extends N{static{s(this,"FeedbackSyncCommand")}static paths=[["feedback","sync"]];static usage=R.Usage({category:"Feedback",description:"Fetch GitHub issue state onto linked feedback (issue closed \u21D2 resolved)."});allTenants=f.Boolean("--all-tenants",!1);async execute(){let n=await this.caller();if(!this.allTenants)throw new Error("feedback sync requires --all-tenants (the GitHub link is platform-admin-only).");let r=(await this.paginate(n,x.platformFeedback.listAllPlatform,{})).filter(o=>o.githubIssue),i=[];for(let o of r){let a=o.githubIssue;if(!a)continue;let l=fh(a),d=`${a.repo}#${l}`,c=Ov(["issue","view",String(l),"--repo",a.repo,"--json","state,stateReason"]);if(!c.ok){i.push({id:o.id,issue:d,state:"error",resolved:""});continue}let u;try{u=JSON.parse(c.stdout)}catch{i.push({id:o.id,issue:d,state:"error",resolved:""});continue}let{state:p,reason:h}=S0(u.state??"",u.stateReason??"");await n.mutation(x.platformFeedback.syncGithubIssueState,{feedbackItemId:o.id,state:p,...h!==void 0?{stateReason:h}:{}}),i.push({id:o.id,issue:d,state:p,resolved:p==="closed"?"\u2713":""})}return this.print(i,o=>o.map(a=>({...a})),["id","issue","state","resolved"]),0}};var Vd=class extends N{static{s(this,"FeedbackSetStatusCommand")}static paths=[["feedback","set-status"]];static usage=R.Usage({category:"Feedback",description:"Manually move a feedback item to a board status."});feedbackId=f.String({required:!0,name:"feedbackId"});status=f.String({required:!0,name:"status"});async execute(){let n=await this.caller();if(!ps.includes(this.status))throw new Error(`feedback set-status: status must be one of ${ps.join("|")}.`);return await n.mutation(x.platformFeedback.setFeedbackStatus,{feedbackItemId:this.feedbackId,status:this.status}),this.print({feedbackId:this.feedbackId,status:this.status},t=>[{field:"feedbackId",value:t.feedbackId},{field:"status",value:t.status}]),0}},Bd=class extends N{static{s(this,"FeedbackReassignCommand")}static paths=[["feedback","reassign"]];static usage=R.Usage({category:"Feedback",description:"Move a feedback item to another tenant (by target tenant slug)."});feedbackId=f.String({required:!0,name:"feedbackId"});tenantSlug=f.String({required:!0,name:"tenantSlug"});async execute(){let n=await this.caller(),t=await n.query(x.platformFeedback.listAllTenantsForAssignment,{}),r=t.find(i=>i.slug===this.tenantSlug);if(r===void 0){let i=t.map(o=>o.slug).join(", ");throw new Error(`feedback reassign: no tenant "${this.tenantSlug}". Available: ${i||"(none)"}.`)}return await n.mutation(x.platformFeedback.reassignTenant,{feedbackItemId:this.feedbackId,newTenantId:r.id}),this.print({feedbackId:this.feedbackId,tenantSlug:this.tenantSlug},i=>[{field:"feedbackId",value:i.feedbackId},{field:"tenantSlug",value:i.tenantSlug}]),0}},Ud=class extends N{static{s(this,"FeedbackReplyCommand")}static paths=[["feedback","reply"]];static usage=R.Usage({category:"Feedback",description:"Post a platform reply on a feedback item (public by default; --internal for a platform-only note)."});feedbackId=f.String({required:!0,name:"feedbackId"});body=f.String({required:!0,name:"body"});internal=f.Boolean("--internal",!1,{description:"Post as an internal note (not visible to the tenant)."});async execute(){let t=await(await this.caller()).mutation(x.platformFeedback.addComment,{feedbackItemId:this.feedbackId,body:this.body,visibility:this.internal?"internal":"public"});return this.print(t,r=>[{field:"id",value:r.id},{field:"visibility",value:r.visibility},{field:"author",value:r.authorName}]),0}},Gd=class extends N{static{s(this,"FeedbackCommentsCommand")}static paths=[["feedback","comments"]];static usage=R.Usage({category:"Feedback",description:"List the conversation (public replies + internal notes) on a feedback item."});feedbackId=f.String({required:!0,name:"feedbackId"});async execute(){let t=await(await this.caller()).query(x.platformFeedback.listComments,{feedbackItemId:this.feedbackId});return this.print(t,r=>r.map(i=>({id:i.id,visibility:i.visibility,author:i.authorName,body:i.body})),["id","visibility","author","body"]),0}},zd=class extends N{static{s(this,"FeedbackDeadlineCommand")}static paths=[["feedback","set-deadline"],["feedback","deadline"]];static usage=R.Usage({category:"Feedback",description:"Set or clear a feedback item's deadline (platform admin)."});feedbackId=f.String({required:!0,name:"feedbackId"});date=f.String({required:!1,name:"date"});clear=f.Boolean("--clear",!1,{description:"Clear the deadline."});async execute(){let n=await this.caller();if(!this.clear&&this.date===void 0)throw new Error("feedback deadline: pass a date (ISO/epoch) or --clear.");let t=this.clear?null:Md(this.date);return await n.mutation(x.platformFeedback.setDeadline,{feedbackItemId:this.feedbackId,deadline:t}),this.print({feedbackId:this.feedbackId,deadline:t===null?"(cleared)":new Date(t).toISOString()},r=>[{field:"feedbackId",value:r.feedbackId},{field:"deadline",value:r.deadline}]),0}},Wd=class extends N{static{s(this,"FeedbackAdminsCommand")}static paths=[["feedback","admins"]];static usage=R.Usage({category:"Feedback",description:"List platform admins (valid feedback assignees)."});async execute(){let t=await(await this.caller()).query(x.platformFeedback.listPlatformAdmins,{});return this.print(t,r=>r.map(i=>({userId:i.userId,name:i.name,email:i.email})),["userId","name","email"]),0}},Yd=class extends N{static{s(this,"FeedbackAssignCommand")}static paths=[["feedback","assign"]];static usage=R.Usage({category:"Feedback",description:"Assign a feedback item to a platform admin (userId or email), or --clear."});feedbackId=f.String({required:!0,name:"feedbackId"});assignee=f.String({required:!1,name:"assignee"});clear=f.Boolean("--clear",!1,{description:"Unassign."});async execute(){let n=await this.caller();if(!this.clear&&this.assignee===void 0)throw new Error("feedback assign: pass a userId/email or --clear.");let t=this.clear?null:await ph(n,this.assignee);return await n.mutation(x.platformFeedback.assign,{feedbackItemId:this.feedbackId,assigneeUserId:t}),this.print({feedbackId:this.feedbackId,assignee:t??"(cleared)"},r=>[{field:"feedbackId",value:r.feedbackId},{field:"assignee",value:r.assignee}]),0}};function ic(e){return[{field:"id",value:e.id},{field:"name",value:e.name},{field:"color",value:e.color},{field:"scope",value:e.scope}]}s(ic,"tagRows");function _v(e){if(e==="public"||e==="platform")return e;throw new Error(`Invalid visibility "${e}" \u2014 expected "public" or "platform".`)}s(_v,"parseTagScope");var Hd=class extends N{static{s(this,"FeedbackTagsListCommand")}static paths=[["feedback","tags","list"]];static usage=R.Usage({category:"Feedback",description:"List the global feedback tag catalog (incl. platform-only tags)."});async execute(){let t=await(await this.caller()).query(x.feedbackTags.listAllTags,{});return this.print(t,r=>r.map(i=>({id:i.id,name:i.name,color:i.color,scope:i.scope})),["id","name","color","scope"]),0}},Jd=class extends N{static{s(this,"FeedbackTagsCreateCommand")}static paths=[["feedback","tags","create"]];static usage=R.Usage({category:"Feedback",description:"Create a tag (platform admin). --color is a 6-hex code, e.g. d73a4a; --visibility is public (default) or platform."});name=f.String({required:!0,name:"name"});color=f.String("--color",{required:!0,description:"6-hex colour (no '#')."});visibility=f.String("--visibility",{description:"public (default) or platform (platform-admins only)."});async execute(){let t=await(await this.caller()).mutation(x.feedbackTags.createTag,{name:this.name,color:this.color,scope:this.visibility?_v(this.visibility):"public"});return this.print(t,ic),0}},Qd=class extends N{static{s(this,"FeedbackTagsSetCommand")}static paths=[["feedback","tags","set"]];static usage=R.Usage({category:"Feedback",description:"Change a tag's name, colour and/or visibility (platform admin).",examples:[["Rename and recolour","$0 --env staging feedback tags set <tagId> --name Bug --color d73a4a"]]});tagId=f.String({required:!0,name:"tagId"});name=f.String("--name",{description:"New name."});color=f.String("--color",{description:"New 6-hex colour (no '#')."});visibility=f.String("--visibility",{description:"public (everyone) or platform (platform-admins only)."});async execute(){if(this.name===void 0&&this.color===void 0&&this.visibility===void 0)throw new Error("feedback tags set: pass at least one of --name, --color, --visibility.");let n=this.visibility===void 0?void 0:_v(this.visibility),t=await this.caller(),r=this.tagId,i,o=[];try{this.name!==void 0&&(i=await t.mutation(x.feedbackTags.renameTag,{tagId:r,name:this.name}),o.push("--name")),this.color!==void 0&&(i=await t.mutation(x.feedbackTags.recolorTag,{tagId:r,color:this.color}),o.push("--color")),n!==void 0&&(i=await t.mutation(x.feedbackTags.setTagVisibility,{tagId:r,scope:n}),o.push("--visibility"))}catch(a){throw o.length>0&&this.context.stderr.write(`feedback tags set: ${o.join(", ")} already applied.
|
|
@@ -11679,7 +11679,7 @@ ${i.map(d=>` ${cc(d)}
|
|
|
11679
11679
|
`),0}},z0=[Zv,Xv,ex];var nx=class extends N{static{s(this,"LeadsListCommand")}static paths=[["leads","list"],["interessenten","list"]];static usage=R.Usage({category:"Admission",description:"List Interessenten (leads) for the active tenant",details:"Lists the tenant's OPEN Interessenten (program interests), newest first. Converted leads are Bewerbungen (listed under applications); withdrawn/declined leads are removed. Use --json for the rich shape.",examples:[["List open Interessenten","plexus-cli leads list"],["As JSON","plexus-cli leads list --json"]]});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.leads.listForManagement,{client:t});return this.print(r,i=>i.map(o=>({name:o.personDisplayName??"\u2014",angebot:o.programName===null?"\u2014":Ce(o.programName),stufe:o.stageName===null?"\u2014":Ce(o.stageName),lauf:o.runName===null?"\u2014":Ce(o.runName)})),["name","angebot","stufe","lauf"]),0}},W0=[nx];function cx(e){return e==null?"":new Date(e).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z")}s(cx,"ts");function H0(e){return e==null?"":`${Math.round((Date.now()-e)/6e4)}m`}s(H0,"ago");var Y0=["queued","running","succeeded","failed","canceled"];function p8(e){let n=Y0.find(t=>t===e);if(n===void 0)throw new Error(`jobs list: --status must be one of ${Y0.join(" | ")}, got "${e}".`);return n}s(p8,"jobStatus");var tx=class extends N{static{s(this,"JobsListCommand")}static paths=[["jobs","list"]];static usage=R.Usage({category:"Jobs",description:"List jobs newest-first (platform-admin). --status / --kind filter."});status=f.String("--status",{description:"queued | running | succeeded | failed | canceled"});kind=f.String("--kind",{description:"import | dummy | document_template_export"});limit=f.String("--limit",{description:"Max rows (default 100)."});all=f.Boolean("--all",!1,{description:"Fetch every page (ignores --limit)."});async execute(){let n=await this.caller(),t=this.all?void 0:Gf(this.limit,100),r=await this.paginate(n,x.jobs.listPage,this.status?{status:p8(this.status)}:{},{max:t,pageSize:Math.min(t??100,100)}),i=this.kind?r.filter(o=>o.kind===this.kind):r;return this.print(i,o=>o.map(a=>({id:a.id,kind:a.kind,status:a.status,tenant:a.tenantSlug??"",phase:a.phase,progress:a.progress?`${a.progress.current}/${a.progress.total}`:"",tries:`${a.attempts}/${a.maxAttempts}`,worker:a.leasedBy??"",updated:H0(a.updatedAt)})),["id","kind","status","tenant","phase","progress","tries","worker","updated"]),0}},rx=class extends N{static{s(this,"JobsShowCommand")}static paths=[["jobs","show"]];static usage=R.Usage({category:"Jobs",description:"Show one job's full detail + per-attempt run timeline."});jobId=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.jobs.getDetail,{jobId:this.jobId});if(t===null)throw new Error(`Job ${this.jobId} not found.`);return this.print(t),0}},ix=class extends N{static{s(this,"JobsLogsCommand")}static paths=[["jobs","logs"]];static usage=R.Usage({category:"Jobs",description:"Tail a job's captured worker output (oldest-first)."});jobId=f.String({required:!0});limit=f.String("--limit",{description:"Max lines (default 500, max 2000)."});async execute(){let t=await(await this.caller()).query(x.jobs.tailLog,{jobId:this.jobId,...this.limit?{limit:Number(this.limit)}:{}});return this.print(t,r=>r.map(i=>({at:cx(i.at),stream:i.stream,text:i.text})),["at","stream","text"]),0}},ox=class extends N{static{s(this,"JobsCancelCommand")}static paths=[["jobs","cancel"]];static usage=R.Usage({category:"Jobs",description:"Cancel a queued/running job (the worker aborts; the domain row is failed) \u2014 irreversible, plan unless --confirm."});jobId=f.String({required:!0});confirm=f.Boolean("--confirm",!1,{description:"Cancel (without it, only the plan is printed)."});async execute(){let n=await this.caller();if(!this.confirm){let t=await n.query(x.jobs.getDetail,{jobId:this.jobId});if(t===null)throw new Error(`Job ${this.jobId} not found.`);return this.print({jobId:this.jobId,kind:t.kind,status:t.status,canceled:!1},r=>[{key:"would cancel",value:`${r.jobId} (${r.kind}, ${r.status})`},{key:"next",value:"re-run with --confirm"}]),0}return await n.mutation(x.jobs.cancel,{jobId:this.jobId}),this.print({canceled:this.jobId}),0}},sx=class extends N{static{s(this,"WorkersLogsCommand")}static paths=[["platform","workers","logs"],["workers","logs"]];static usage=R.Usage({category:"Platform",description:"Tail one worker's captured stdout/stderr."});workerId=f.String({required:!0});limit=f.String("--limit",{description:"Max lines (default 500, max 2000)."});async execute(){let t=await(await this.caller()).query(x.workers.tailLog,{workerId:this.workerId,...this.limit?{limit:Number(this.limit)}:{}});return this.print(t,r=>r.map(i=>({at:cx(i.at),stream:i.stream,text:i.text})),["at","stream","text"]),0}},ax=class extends N{static{s(this,"WorkersReaperStatusCommand")}static paths=[["platform","workers","reaper-status"],["workers","reaper-status"]];static usage=R.Usage({category:"Platform",description:"Show the last worker-reaper tick (confirm the cron is firing)."});async execute(){let t=await(await this.caller()).query(x.workers.reaperStatus,{});return t===null?(this.print({reaper:"no tick recorded yet"}),0):(this.print({...t,ranAt:cx(t.ranAt)}),0)}},lx=class extends N{static{s(this,"WorkersReapCommand")}static paths=[["platform","workers","reap"],["workers","reap"]];static usage=R.Usage({category:"Platform",description:"Force a reaper pass NOW (free dead leases / fail stalled jobs)."});async execute(){let t=await(await this.caller()).mutation(x.workers.reap,{});return this.print(t),0}},dx=class extends N{static{s(this,"ImportsCleanupOrphansCommand")}static paths=[["platform","imports","cleanup-orphaned"],["imports","cleanup-orphaned"]];static usage=R.Usage({category:"Imports",description:"Find/fail orphaned import runs (status 'running' with no active job). Dry-run unless --confirm."});allTenants=f.Boolean("--all-tenants",!1,{description:"Scan every tenant (default: the active --tenant only)."});confirm=f.Boolean("--confirm",!1,{description:"Actually mark orphans failed (default: dry-run preview)."});async execute(){let n=await this.caller(),t=this.allTenants?void 0:this.requireTenant(n),r=await n.mutation(x.imports.failOrphanedRuns,{...t?{tenantSlug:t}:{},confirm:this.confirm});return this.print(r,i=>i.orphans.map(o=>({id:o.id,tenant:o.tenantSlug,importRunId:o.importRunId,phase:o.phase??"",updated:H0(o.updatedAt),action:i.confirmed?"failed":"would-fail"})),["id","tenant","importRunId","phase","updated","action"]),0}},J0=[tx,rx,ix,ox,sx,ax,lx,dx];var m8=/^(\d+)([mhd])$/,h8={m:6e4,h:36e5,d:864e5};function kh(e,n=Date.now()){let t=e.trim(),r=m8.exec(t);if(r!==null)return n-Number(r[1])*h8[r[2]];let i=/^\d{4}-\d{2}-\d{2}/.test(t)?Date.parse(t):Number.NaN;if(Number.isNaN(i))throw new Error(`--since "${e}": expected 90m, 24h, 2d or an ISO date like 2026-10-13T11:40Z`);return i}s(kh,"parseSince");function bh(e){return e==null?"":new Date(e).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z")}s(bh,"ts");function xx(e,n){if(e===void 0)throw new Error(`notifications ${n}: --locale is required (${Be.join("|")}) \u2014 every letter exists in each language, and each is worded on its own`);if(!Zm(e))throw new Error(`notifications: --locale "${e}" is not a supported locale (${Be.join("|")})`);return e}s(xx,"parseLocale");function g8(e,n){let t={},r=s((i,o,a)=>{let l=o.indexOf("=");if(l<=0)throw new Error(`notifications letters: malformed ${i} "${o}" (expected <blockKey>=<value>)`);let d=o.slice(0,l).trim();if(!d)throw new Error(`notifications letters: malformed ${i} "${o}" (empty block key)`);if(d in t)throw new Error(`notifications letters: block "${d}" given twice \u2014 one value per block.`);t[d]=a(o.slice(l+1))},"put");for(let i of e??[])r("--slot",i,o=>o);for(let i of n??[])r("--slot-file",i,o=>he(o.trim(),"utf8"));return t}s(g8,"parseSlots");var ux=class extends N{static{s(this,"NotificationsListCommand")}static paths=[["platform","notifications","list"],["notifications","list"]];static usage=R.Usage({category:"Notifications",description:"List mail deliveries newest-first (platform-admin). Filter by --status, --template, --to, --since; the smtp column is the relay's answer (`250 \u2026 queued as <id>` = accepted).",examples:[["Dead-letters only","$0 notifications list --status dead"],["Everything still in flight","$0 notifications list --status queued"],["Did the login-page link to this address go out today?","$0 notifications list --template account.loginLink --to steffi@schule.example --since 24h"]]});status=f.String("--status",{description:"queued | sending | sent | skipped | dead"});template=f.String("--template",{description:"Only this letter, e.g. account.loginLink."});to=f.String("--to",{description:"Only deliveries to this address."});since=f.String("--since",{description:"Created since: 90m, 24h, 2d or an ISO date/time."});limit=f.String("--limit",{description:"Max rows (default 100)."});all=f.Boolean("--all",!1,{description:"Fetch every page (ignores --limit)."});async execute(){let n=await this.caller(),t=this.all?void 0:Gf(this.limit,100),r=await this.paginate(n,x.notifications.listPage,{...this.status?{status:this.status}:{},...this.template?{templateId:this.template}:{},...this.to?{recipientEmail:this.to}:{},...this.since?{since:kh(this.since)}:{}},{max:t,pageSize:Math.min(t??100,100)});return this.print(r,i=>i.map(o=>({id:o.id,template:o.templateId,status:o.status,tenant:o.tenantSlug??"",to:o.recipientEmail,files:o.attachmentCount>0?String(o.attachmentCount):"",tries:`${o.attempts}/${o.maxAttempts}`,error:o.errorCode??"",mode:o.transportMode??"",dup:o.possibleDuplicate?"!":"",created:bh(o.createdAt),settled:bh(o.settledAt),smtp:o.lastSmtpResponse??""})),["id","template","status","tenant","to","files","tries","error","mode","dup","created","settled","smtp"]),0}};function y8(e){if(e.letter===null)return{...e,attachments:[]};let{attachments:n,...t}=e.letter;return{...e,attachments:n.map(({filename:r,contentType:i,size:o})=>({filename:r,contentType:i,size:o})),letter:t}}s(y8,"showView");var fx=class extends N{static{s(this,"NotificationsShowCommand")}static paths=[["platform","notifications","show"],["notifications","show"]];static usage=R.Usage({category:"Notifications",description:"Show one delivery in full: SMTP evidence, lease, sweeper bookkeeping, template summary."});deliveryId=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.notifications.getDetail,{deliveryId:this.deliveryId});if(t===null)throw new Error(`Delivery ${this.deliveryId} not found.`);return this.print(y8(t)),0}},px=class extends N{static{s(this,"NotificationsRetryCommand")}static paths=[["platform","notifications","retry"],["notifications","retry"]];static usage=R.Usage({category:"Notifications",description:"Retry a DEAD delivery: a fresh attempt through the normal claim path. Check `show` first \u2014 a `possibleDuplicate` row may already have reached the recipient."});deliveryId=f.String({required:!0});async execute(){return await(await this.caller()).mutation(x.notifications.retry,{deliveryId:this.deliveryId}),this.print({deliveryId:this.deliveryId,status:"queued"}),0}},mx=class extends N{static{s(this,"NotificationsSweeperStatusCommand")}static paths=[["platform","notifications","sweeper-status"],["notifications","sweeper-status"]];static usage=R.Usage({category:"Notifications",description:"Last tick of the notification sweeper cron (deadLastHour is the number to watch)."});async execute(){let t=await(await this.caller()).query(x.notifications.sweeperStatus,{});return t===null?(this.print({ranAt:null,note:"sweeper has not run since deploy"}),0):(this.print({...t,ranAt:bh(t.ranAt),lastDeadAt:bh(t.lastDeadAt)}),0)}},hx=class extends N{static{s(this,"NotificationsSelfTestCommand")}static paths=[["platform","notifications","self-test"],["notifications","self-test"]];static usage=R.Usage({category:"Notifications",description:"Resolve the deployment's mail config, verify the SMTP connection + credentials, and send ONE test mail to --to with the raw SMTP transcript. A redirect deployment redirects the test too; dry sends nothing.",examples:[["Probe staging","$0 --env staging notifications self-test --to you@example.com"]]});to=f.String("--to",{required:!0,description:"Explicit recipient (never defaulted)."});async execute(){let t=await(await this.caller()).action(x.notificationActions.selfTest,{recipient:this.to});return this.print(t),t.ok?0:1}},gx=class extends N{static{s(this,"NotificationsLettersListCommand")}static paths=[["notifications","letters","list"]];static usage=R.Usage({category:"Notifications",description:"The letter catalog for one school: what it can reword, and what it already did.",details:"Only the letters a school may actually write are listed \u2014 addressed to families, and with blocks to rewrite. A staff-internal letter or a retired one is not offered at all. `reworded` names the languages in which this school has already deviated from a letter.",examples:[["The catalog","$0 --tenant test notifications letters list"],["Only the reworded ones","$0 --tenant test notifications letters list --json"]]});async execute(){let n=await this.caller(),t=await n.query(x.notifications.letterWorkspace,{tenantSlug:this.requireTenant(n),locale:"de"});return this.print(t.letters,r=>r.map(i=>({template:i.id,label:i.label,blocks:i.slots.map(o=>o.key).join(", "),reworded:i.rewordedIn.join(", ")})),["template","label","blocks","reworded"]),0}},yx=class extends N{static{s(this,"NotificationsLettersShowCommand")}static paths=[["notifications","letters","show"]];static usage=R.Usage({category:"Notifications",description:"One letter block by block: the current text, whether it deviates, and the placeholders it may use.",examples:[["The welcome letter","$0 --tenant test notifications letters show applicant.welcome --locale de"],["Its English version","$0 --tenant test notifications letters show applicant.welcome --locale en"]]});templateId=f.String({required:!0});locale=f.String("--locale",{description:`Letter language (${Be.join("|")}) \u2014 required; each language is worded on its own`});async execute(){let n=await this.caller(),t=await n.query(x.notifications.letterWorkspace,{tenantSlug:this.requireTenant(n),locale:xx(this.locale,"letters show")}),r=t.letters.find(i=>i.id===this.templateId);if(r===void 0)throw new Error(`notifications letters show: "${this.templateId}" is not a letter this school may reword \u2014 known: ${t.letters.map(i=>i.id).join(", ")}`);if(!this.json){let i=r.placeholders.map(o=>`{{${o.key}}}${o.required?" (Pflicht)":""}`).join(", ");this.context.stdout.write(`${r.label} \u2014 ${r.occasion.de}
|
|
11680
11680
|
Platzhalter: ${i||"\u2014"}
|
|
11681
11681
|
|
|
11682
|
-
`)}return this.print(r,i=>i.slots.map(o=>{let a=i.override?.[o.key];return{block:o.key,label:o.label,deviates:a===void 0?"":"yes",text:(a??o.default).replace(/\s+/g," ").slice(0,80)}}),["block","label","deviates","text"]),0}},wx=class extends N{static{s(this,"NotificationsLettersSetCommand")}static paths=[["notifications","letters","set"]];static usage=R.Usage({category:"Notifications",description:"Reword one or more blocks of a letter for this school (merge \u2014 untouched blocks stay as they are).",details:"A block whose text EQUALS the platform default is dropped rather than stored: what is kept is the deviation, never a copy, so a later improvement to an untouched block still reaches this school. An unknown block or an undeclared {{placeholder}} is refused by the backend with every finding named \u2014 nothing is written.",examples:[["One paragraph",'$0 --tenant test notifications letters set applicant.welcome --locale de --slot intro="Sch\xF6n, dass Sie da sind."'],["The English letter",'$0 --tenant test notifications letters set applicant.welcome --locale en --slot intro="Lovely to have you."'],["From a file","$0 --tenant test notifications letters set applicant.tasksOpen --locale de --slot-file intro=./intro.txt"]]});templateId=f.String({required:!0});locale=f.String("--locale",{description:`Letter language (${Be.join("|")}) \u2014 required; each language is worded on its own`});slot=f.Array("--slot",{description:"<blockKey>=<text> (repeatable)"});slotFile=f.Array("--slot-file",{description:"<blockKey>=<path> \u2014 read the text from a local file (repeatable)"});async execute(){let n=g8(this.slot,this.slotFile);if(Object.keys(n).length===0)throw new Error("notifications letters set: nothing to write \u2014 pass --slot <blockKey>=<text> or --slot-file <blockKey>=<path>");let t=await this.caller(),r=await t.mutation(x.notifications.saveLetterOverride,{tenantSlug:this.requireTenant(t),templateId:this.templateId,locale:xx(this.locale,"letters set"),slots:n});return this.print({templateId:this.templateId,submitted:Object.keys(n),...r},i=>[{key:"letter",value:i.templateId},{key:"submitted",value:i.submitted.join(", ")},{key:"deviating blocks",value:i.overriddenSlotKeys.join(", ")||"\u2014 (back to the platform text)"}]),0}},kx=class extends N{static{s(this,"NotificationsLettersResetCommand")}static paths=[["notifications","letters","reset"]];static usage=R.Usage({category:"Notifications",description:"Drop this school's deviations \u2014 named blocks, or the whole letter with --all.",details:"--all is required to drop a whole letter: dropping everything must be typed, never be what happens when a --slot is forgotten.",examples:[["One block back to the platform text","$0 --tenant test notifications letters reset applicant.welcome --locale de --slot intro"],["The whole letter","$0 --tenant test notifications letters reset applicant.welcome --locale en --all"]]});templateId=f.String({required:!0});locale=f.String("--locale",{description:`Letter language (${Be.join("|")}) \u2014 required; each language is worded on its own`});slot=f.Array("--slot",{description:"Block key to reset (repeatable)"});all=f.Boolean("--all",!1,{description:"Reset every block of this letter"});async execute(){let n=(this.slot??[]).map(i=>i.trim()).filter(Boolean);if(this.all&&n.length>0)throw new Error("notifications letters reset: --all resets everything \u2014 it cannot be combined with --slot.");if(!this.all&&n.length===0)throw new Error("notifications letters reset: name the blocks with --slot <blockKey>, or pass --all to reset the whole letter.");let t=await this.caller(),r=await t.mutation(x.notifications.resetLetterOverride,{tenantSlug:this.requireTenant(t),templateId:this.templateId,locale:xx(this.locale,"letters reset"),...this.all?{}:{slotKeys:n}});return this.print({templateId:this.templateId,reset:this.all?"all":n.join(", "),...r},i=>[{key:"letter",value:i.templateId},{key:"reset",value:i.reset},{key:"still deviating",value:i.overriddenSlotKeys.join(", ")||"\u2014 (nothing)"}]),0}},pc=s((e,n)=>e==null?n:e.replace(/\s*\n\s*/g," \u23CE "),"flatCell");function vh(e,n,t){return["de","en"].map(r=>({field:`${e} (${r})`,school:n===null?"\u2014 (platform)":n[r]===""?"\u2014 (untranslated)":pc(n[r],""),...t===null?{}:{platform:pc(t[r],"")}}))}s(vh,"chromeTextRows");var bx=class extends N{static{s(this,"NotificationsChromeShowCommand")}static paths=[["notifications","chrome","show"]];static usage=R.Usage({category:"Notifications",description:"The school's letter frame (greeting and sign-off per language, sender name) and the platform wording each falls back to."});async execute(){let n=await this.caller(),t=await n.query(x.notifications.getTenantChrome,{tenantSlug:this.requireTenant(n)});return this.print(t,r=>[...vh("greeting",r.greeting,r.defaults.greeting),...vh("closing",r.closing,r.defaults.closing),{field:"senderName",school:pc(r.senderName,"\u2014 (platform)"),platform:pc(r.defaults.senderName,"")}],["field","school","platform"]),0}},vx=class extends N{static{s(this,"NotificationsChromeSetCommand")}static paths=[["notifications","chrome","set"]];static usage=R.Usage({category:"Notifications",description:"Set the school's letter frame. Greeting and sign-off are set in BOTH languages at once; both EMPTY clears that field back to the platform wording.",examples:[["Own sign-off",'$0 --tenant test notifications chrome set --closing-de="Herzliche Gr\xFC\xDFe, Ihr Grundschul-Team" --closing-en="Warm regards, your primary school team"'],["Back to the platform sign-off",'$0 --tenant test notifications chrome set --closing-de="" --closing-en=""']]});greetingDe=f.String("--greeting-de",{description:"Opening line, German"});greetingEn=f.String("--greeting-en",{description:"Opening line, English"});closingDe=f.String("--closing-de",{description:"Sign-off, German"});closingEn=f.String("--closing-en",{description:"Sign-off, English"});senderName=f.String("--sender-name",{description:"Name the school signs with (empty string clears it)"});async execute(){let n=s((l,d,c)=>{if(!(d===void 0&&c===void 0)){if(d===void 0||c===void 0)throw new Error(`notifications chrome set: --${l}-de and --${l}-en go together \u2014 the frame is worded in every language`);return{de:d,en:c}}},"pair"),t=n("greeting",this.greetingDe,this.greetingEn),r=n("closing",this.closingDe,this.closingEn);if(t===void 0&&r===void 0&&this.senderName===void 0)throw new Error("notifications chrome set: nothing to change \u2014 pass --greeting-de/--greeting-en, --closing-de/--closing-en or --sender-name");let i=await this.caller(),o=this.requireTenant(i);await i.mutation(x.notifications.saveTenantChrome,{tenantSlug:o,...t!==void 0?{greeting:t}:{},...r!==void 0?{closing:r}:{},...this.senderName!==void 0?{senderName:this.senderName}:{}});let a=await i.query(x.notifications.getTenantChrome,{tenantSlug:o});return this.print(a,l=>[...vh("greeting",l.greeting,null),...vh("closing",l.closing,null),{field:"senderName",school:pc(l.senderName,"\u2014 (platform)")}],["field","school"]),0}},Q0=[ux,fx,px,mx,hx,gx,yx,wx,kx,bx,vx];var w8={capacity:null,isOpen:!1},k8={capacity:null,isOpen:!0};function b8(e){return e===null||e==="unlimited"||typeof e=="number"&&Number.isInteger(e)&&e>=0}s(b8,"isCapacity");function xh(e,n){let t=[],r=n===void 0?void 0:new Set(n);return e.forEach((i,o)=>{if(i.capacities===void 0)return;let a=`program.runs[${o}] ("${i.key}")`;if(i.isOpen!==void 0&&t.push(`[capacity/runIsOpenWithCells] ${a}: \`isOpen\` on the run AND \`capacities\` \u2014 the open state lives on each cell; drop the run-level \`isOpen\``),i.capacities===null||typeof i.capacities!="object"||Array.isArray(i.capacities)){t.push(`[capacity/shape] ${a}: \`capacities\` must map stage keys to { isOpen, capacity }`);return}for(let[l,d]of Object.entries(i.capacities)){let c=`${a}.capacities.${l}`;r!==void 0&&!r.has(l)&&t.push(`[capacity/unknownStage] ${c}: no stage with key "${l}" in program.stages (have: ${[...r].join(", ")||"none"})`);let u=d;if(u===null||typeof u!="object"){t.push(`[capacity/shape] ${c}: expected { isOpen, capacity }`);continue}typeof u.isOpen!="boolean"&&t.push(`[capacity/isOpen] ${c}: \`isOpen\` must be true or false`),(!("capacity"in u)||!b8(u.capacity))&&t.push(`[capacity/value] ${c}: \`capacity\` must be a whole number \u2265 0, "unlimited", or null (unconfigured) \u2014 got ${JSON.stringify(u.capacity)}`)}}),t}s(xh,"capacitySpecIssues");function X0(e,n,t={stageKeys:[],runKeys:[]}){let r=e.programKey,i=new Map;if(r!==null)for(let c of e.stages)c.archived||i.set(Jr(r,c.key),c.stageId);let o=new Set(t.stageKeys),a=new Set(t.runKeys),l=new Map(e.runStages.map(c=>[`${c.runId}|${c.stageId}`,c])),d=[];for(let c of n){if(c.capacities===void 0)continue;let u=r===null?void 0:e.runs.find(p=>p.key===nr(r,c.key));if(u===void 0&&!a.has(c.key))throw new Error(`offer[admission]: run "${c.key}" does not exist and is not created by this apply`);for(let[p,h]of Object.entries(c.capacities)){let y=i.get(p);if(y===void 0&&!o.has(p))throw new Error(`offer[admission]: capacities of run "${c.key}" name stage "${p}", which the program does not have (have: ${[...i.keys()].join(", ")||"none"})`);let k={capacity:h.capacity,isOpen:h.isOpen},w=u!==void 0&&y!==void 0?l.get(`${u.runId}|${y}`):void 0,b=w!==void 0?{capacity:w.capacity,isOpen:w.isOpen}:u===void 0?w8:k8;b.capacity===k.capacity&&b.isOpen===k.isOpen||d.push({run:c.key,stageKey:p,from:b,to:k})}}return d}s(X0,"planRunCapacities");function Z0(e){return`${e.capacity===null?"unconfigured":String(e.capacity)}/${e.isOpen?"open":"closed"}`}s(Z0,"describeCell");function Sh(e){return`~cap ${e.run}\xD7${e.stageKey} ${Z0(e.from)} \u2192 ${Z0(e.to)}`}s(Sh,"describeCapacityStep");function eM(e){if(e.programKey===void 0)throw new Error("offer[admission]: the target backend predates stage keys \u2014 deploy it before running offer plan / apply / export with this CLI")}s(eM,"assertBackendHasStageKeys");async function Sx(e,n,t,r){let i=await e.query(x.programAdmin.getAngebotConfig,{client:n,offerKey:t,includeArchived:!0}),o=i.stages.map(u=>({stageId:u.stageId,key:u.key,name:u.name,...u.gradeLevel!==void 0?{gradeLevel:u.gradeLevel}:{},sequence:u.sequence,archived:u.archived}));eM(i);let a=rp(i.programKey,o,r),l=a.flatMap(u=>u.op==="archive"?[u.stageId]:[]);if(l.length===0)return a;let d=await e.query(x.programAdmin.getStageOccupancy,{client:n,offerKey:t,stageIds:l}),c=new Map(d.map(u=>[u.stageId,u]));return a.map(u=>{if(u.op!=="archive")return u;let p=c.get(u.stageId);if(p===void 0)throw new Error(`offer[admission]: no occupancy returned for stage ${u.stageId}`);return{...u,occupancy:{activeApplications:p.activeApplications,openLeads:p.openLeads}}})}s(Sx,"planStages");async function Ah(e,n,t,r){let i=r.program?.runs??[];if(!i.some(c=>c.capacities!==void 0))return[];let o=t===null?{programKey:null,stages:[],runs:[],runStages:[]}:await e.query(x.programAdmin.getAngebotConfig,{client:n,offerKey:t});eM(o);let a=new Set(o.programKey===null?[]:o.stages.map(c=>Jr(o.programKey,c.key))),l=r.program?.stages?.map(c=>c.key)??[],d=o.programKey;return X0(o,i,{stageKeys:l.filter(c=>!a.has(c)),runKeys:i.map(c=>c.key).filter(c=>d===null||!o.runs.some(u=>u.key===nr(d,c)))})}s(Ah,"planCapacities");async function v8(e,n,t,r){let i=(r.program?.runs??[]).map(d=>d.key);if(i.length===0)return;let o=await e.query(x.programAdmin.getAngebotConfig,{client:n,offerKey:t,includeArchived:!0}),a=o.programKey;if(a===null)return;let l=i.filter(d=>o.runs.some(c=>c.key===nr(a,d)&&c.status==="archived"));if(l.length>0)throw new Error(`offer[admission]: run(s) ${l.map(d=>`"${d}"`).join(", ")} exist only ARCHIVED \u2014 restore with \`offer run restore --run <key>\` or drop the bundle entry`)}s(v8,"assertNoArchivedRunKey");var Ax={name:"admission",async scaffold(e,n,t,r){let i=t.tenant,o=t.program?.stages,a=[...tp(o??[]),...np(t.program?.runs??[])];if(a.length>0)throw new Error(`offer[admission]: ${a.map(w=>w.message.de).join("; ")}`);let l=xh(t.program?.runs??[],o?.map(w=>w.key));if(l.length>0)throw new Error(`offer[admission]: ${l.join("; ")}`);await v8(e,i,n,t);let d=await Ah(e,i,n,t),c=await e.query(x.programAdmin.getAngebotConfig,{client:i,offerKey:n}),u=x8(t);if(!u)throw new Error("offer[admission]: no unit to link \u2014 set links.unitKey or program.unitKey in bundle.yaml");let p=c.units.find(w=>w.key===u);if(!p)throw new Error(`offer[admission]: unit "${u}" not found in tenant "${i}". Available keys: ${c.units.flatMap(w=>w.key===null?[]:[w.key]).join(", ")||"(none)"}`);let h=[];if(r.dryRun||(await e.mutation(x.programAdmin.ensurePedagogyUnit,{client:i,unitId:p.unitId}),await e.mutation(x.programAdmin.createProgramForAngebot,{client:i,offerKey:n,unitId:p.unitId,...t.program?.key!==void 0?{programKey:t.program.key}:{}})),h.push(`unit=${u}`),o!==void 0)if(r.dryRun){let w=await Sx(e,i,n,o);h.push(...w.map(ip))}else{let w=await e.mutation(x.programAdmin.reconcileProgramStages,{client:i,offerKey:n,stages:o.map(b=>({key:b.key,name:b.name,...b.gradeLevel!==void 0?{gradeLevel:b.gradeLevel}:{}}))});h.push(...w.steps,...w.warnings.map(b=>`warning ${b}`))}let y=r.dryRun?c:await e.query(x.programAdmin.getAngebotConfig,{client:i,offerKey:n});for(let w of t.program?.runs??[]){let b=y.programKey===null?void 0:y.runs.find(T=>T.key===nr(y.programKey,w.key));if(b!==void 0){zs(b.name,w.name)||(r.dryRun||await e.mutation(x.programAdmin.updateProgramRun,{client:i,offerKey:n,runId:b.runId,name:w.name}),h.push(`~run ${w.key} ("${Ce(b.name)}" \u2192 "${Ce(w.name)}")`));continue}r.dryRun||await e.mutation(x.programAdmin.addProgramRun,{client:i,offerKey:n,key:w.key,name:w.name,isOpen:w.capacities!==void 0?!1:w.isOpen??!0,...w.startDate?{startDate:w.startDate}:{},...w.endDate?{endDate:w.endDate}:{}}),h.push(`+run ${w.key} (${Ce(w.name)})`)}let k=r.dryRun?d:await Ah(e,i,n,t);if(!r.dryRun&&k.length>0){let w=await e.query(x.programAdmin.getAngebotConfig,{client:i,offerKey:n}),b=w.programKey;if(b===null)throw new Error("offer[admission]: capacities need a program \u2014 none was linked");for(let T of k){let E=w.runs.find(C=>C.key===nr(b,T.run))?.runId,$=w.stages.find(C=>Jr(b,C.key)===T.stageKey)?.stageId;if(E===void 0||$===void 0)throw new Error(`offer[admission]: cell ${T.run}\xD7${T.stageKey} vanished between plan and write`);await e.mutation(x.programAdmin.setRunStageCapacity,{client:i,offerKey:n,runId:E,stageId:$,capacity:T.to.capacity,isOpen:T.to.isOpen})}}return h.push(...k.map(Sh)),h.join(", ")}};function x8(e){let n=e.program?.unitKey,t=e.links?.unitKey;if(n!==void 0&&t!==void 0&&n!==t)throw new Error(`offer[admission]: bundle.yaml names two units \u2014 program.unitKey "${n}" and links.unitKey "${t}"; keep one`);return n??t}s(x8,"bundleUnitKey");var nM={role:"control",effect:"pure",cardinality:"N-to-1"};var Eh=["add","remove","replace"];function tM(e,n){let t=e.inputs?.[n];if(!(!t||t.kind!=="literal"))return t.value!=null?String(t.value):void 0}s(tM,"roleAssignLiteral");var rM={role:"method",effect:"context-mutation",inputs:s(()=>[{id:"person",label:{de:"Person",en:"Person"},type:"personRef",required:!0},{id:"roleKey",label:{de:"Rolle",en:"Role"},type:"roleKey",required:!0,optionSource:"tenantRoles"},{id:"mode",label:{de:"Modus",en:"Mode"},type:"enum",defaultValue:"add",optionSource:"declared",enumOptions:[{value:"add",label:{de:"Rolle hinzuf\xFCgen",en:"Add role"}},{value:"remove",label:{de:"Rolle entziehen",en:"Remove role"}},{value:"replace",label:{de:"Alle Rollen ersetzen",en:"Replace all roles"}}]}],"inputs"),validate:s((e,n,t)=>{let r=[],i=tM(e,"roleKey")?.trim()??"",o=tM(e,"mode")??"add";return i===""?r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.roleKey`,reason:{de:`[roleAssign/missingRoleKey] roleAssign-Knoten "${e.id}" nennt keine Rolle \u2014 welche Rolle vergeben wird, muss der Autor aus dem Rollenkatalog des Mandanten w\xE4hlen.`,en:`[roleAssign/missingRoleKey] roleAssign node "${e.id}" names no role \u2014 the author must choose which role is assigned from the school's role catalog.`},severity:"error"}):t?.roleKeys!==void 0&&!t.roleKeys.has(i)?r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.roleKey`,reason:{de:`[roleAssign/unknownRoleKey] Rolle "${i}" existiert nicht im Rollenkatalog des Mandanten \u2014 der Knoten w\xFCrde bei jeder Ausf\xFChrung abbrechen. Bekannte Rollen: ${[...t.roleKeys].sort().join(", ")}.`,en:`[roleAssign/unknownRoleKey] Role "${i}" does not exist in the school's role catalog \u2014 the node would abort on every run. Known roles: ${[...t.roleKeys].sort().join(", ")}.`},severity:"error"}):t?.assignableRoleKeys!==void 0&&!t.assignableRoleKeys.has(i)&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.roleKey`,reason:{de:`[roleAssign/nonLeafRoleKey] Rolle "${i}" hat untergeordnete Rollen und ist deshalb nicht vergebbar \u2014 eine Partei bekommt ein Blatt, keine Oberkategorie. Vergebbare Rollen: ${[...t.assignableRoleKeys].sort().join(", ")}.`,en:`[roleAssign/nonLeafRoleKey] Role "${i}" has sub-roles and therefore cannot be assigned \u2014 a party gets a leaf role, not a parent category. Assignable roles: ${[...t.assignableRoleKeys].sort().join(", ")}.`},severity:"error"}),Eh.includes(o)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.mode`,reason:{de:`[roleAssign/unknownMode] roleAssign-Knoten "${e.id}" deklariert Modus "${o}" \u2014 erlaubt sind ${Eh.join(" | ")}.`,en:`[roleAssign/unknownMode] roleAssign node "${e.id}" declares mode "${o}" \u2014 allowed are ${Eh.join(" | ")}.`},severity:"error"}),r},"validate")};var S8=["event","effect","outcomes"],Ex=s((e,n,t)=>({layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:n,en:t},severity:"error"}),"issue"),iM={outcomes:[{id:Tr,label:{de:"Gestartet",en:"Started"}}],validate:s((e,n)=>{let t=[],r=e;for(let i of S8)i in r&&t.push(Ex(`nodes.${e.id}.${i}`,`[graph/retiredField] Start-Knoten "${e.id}": \`${i}\` gibt es nicht mehr \u2014 der Knotentyp deklariert seinen einen Ausgang \u201E${Tr}" selbst.`,`[graph/retiredField] Start node "${e.id}": \`${i}\` no longer exists \u2014 the node type declares its one outcome "${Tr}" itself.`));return sr(n.nodes).some(i=>i.target===e.id)&&t.push(Ex(`nodes.${e.id}`,`[eventTrigger/notStart] Knoten "${e.id}" ist ein Start-Knoten, hat aber eine eingehende Kante \u2014 nur der Start l\xF6st ihn aus, jeder Vorgang bliebe hier stehen.`,`[eventTrigger/notStart] Node "${e.id}" is a start node but has an incoming edge \u2014 only the start triggers it, every process would stop here.`)),e.next?.[Tr]===void 0&&t.push(Ex(`nodes.${e.id}.next.${Tr}`,`[eventTrigger/unroutedStart] Start-Knoten "${e.id}" leitet \u201E${Tr}" nirgendwohin.`,`[eventTrigger/unroutedStart] Start node "${e.id}" routes "${Tr}" nowhere.`)),t},"validate")};var A8="submit",oM=[{id:A8,kind:"advance",label:{de:"Absenden",en:"Submit"},availableIn:["draft"]}];function sM(e){return e==="draft"}s(sM,"isWritableSmartFormState");var Tx=["draft","committed"],ENe=Tx.filter(e=>sM(e));async function aM(e,n,t){let r=await e.db.query("smart_form_instances").withIndex("by_applicationId_and_formNodeId",i=>i.eq("applicationId",n).eq("formNodeId",t)).take(2);return r.length>1&&F(`application ${n}: two form instances for node "${t}" (${r[0]._id}, ${r[1]._id}) \u2014 at most one may exist`),r[0]??null}s(aM,"getSmartFormInstance");var lM="form:fill",Rx="request:collectPayment",$x="request:collectPaymentSeparate",si="confirmPayment";var E8={key:lM,recipient:"external",title:{de:"Bewerbung ausf\xFCllen & absenden",en:"Complete & submit application"},unlocks:["submit"],advancesNode:!0},dM={key:"bearbeitung",label:te("In Bearbeitung","In progress"),scope:"node"},cM={[$O]:{label:te("In Bearbeitung","In progress"),tone:"neutral",phase:dM,external:nn(te("Entwurf","Draft"),"neutral",te("Bewerbung fortsetzen","Continue application"),te("Sie haben die Bewerbung bereits begonnen. Schlie\xDFen Sie sie ab, um sie einzureichen.","You have already started the application. Complete it to submit it."),te("Bewerbung fortsetzen","Continue application"),"continue-form")},[ap]:{label:te("Eingereicht","Submitted"),tone:"blue",phase:dM,external:nn(te("Eingereicht","Submitted"),"blue",te("Ihre Bewerbung ist eingereicht","Your application has been submitted"),te("Ihre Bewerbung ist bei uns eingegangen. Wir melden uns mit den n\xE4chsten Schritten.","We have received your application. We will be in touch with the next steps."))}},uM={role:"user-action",effect:"side-effect",progressDefaults:cM,progressEvents:Gn(cM),actions:s(()=>oM,"actions"),workItemTemplates:s(()=>[E8],"workItemTemplates"),states:Tx,currentState:s(async(e,n)=>{let t=await aM(e,n.applicationId,n.node.id);return t===null?"draft":t.state},"currentState"),inputs:s(e=>[{id:"smartForm",label:{de:"Formular",en:"Form"},type:"smartForm",optionSource:"offerSmartForms",required:e.adoptForm===void 0,inspector:"literal-only"}],"inputs"),outputs:s(e=>[{name:"admission",type:"admission",label:{de:"Anmeldung",en:"Application"},schema:[{key:"beneficiary",type:"personRef",label:{de:"Beschulte Person",en:"Student"}},{key:"signers",type:"personList",label:{de:"Unterzeichner",en:"Signers"}},...e.formExports??[]]}],"outputs"),notificationEvents:s(e=>Ot(e)?[]:[{id:lp,label:{de:"Formular abgesendet",en:"Form submitted"},audience:"external",args:[{key:"applicationId",type:"string",required:!0}]}],"notificationEvents"),validate:s(e=>{let n=[],t=e.inputs?.smartForm,r=t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0,i=e.adoptForm!==void 0;return r&&i?n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.adoptForm`,reason:{de:`[form.adopt-xor-create] Form-Knoten "${e.id}" hat sowohl ein smartForm als auch adoptForm \u2014 genau eines ist erlaubt.`,en:`[form.adopt-xor-create] Form node "${e.id}" has both a smartForm and adoptForm \u2014 exactly one is allowed.`},severity:"error"}):!r&&!i&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.smartForm`,reason:{de:`[form.adopt-xor-create] Form-Knoten "${e.id}" braucht entweder ein smartForm (neu erzeugen) oder adoptForm (bestehende Instanz \xFCbernehmen).`,en:`[form.adopt-xor-create] Form node "${e.id}" needs either a smartForm (create new) or adoptForm (adopt an existing instance).`},severity:"error"}),n},"validate")};var fM={role:"system-action",effect:"side-effect",inputs:s(()=>[{id:Mn.target,label:{de:"Formular",en:"Form"},type:"admission",required:!0,inspector:"binding-only"},{id:Mn.flagKey,label:{de:"Merkmal im Formular",en:"Flag in the form"},type:"formFlag",required:!0,inspector:"literal-only",optionSource:"targetFormFlags"},{id:Mn.value,label:{de:"Setzen oder zur\xFCcknehmen",en:"Raise or lower"},type:"boolean",defaultValue:!0,inspector:"literal-only",enumOptions:[{value:"true",label:{de:"Setzen",en:"Raise"}},{value:"false",label:{de:"Zur\xFCcknehmen",en:"Lower"}}]}],"inputs"),notificationEvents:s(e=>[{id:"unlocked",label:{de:"Abschnitt freigeschaltet",en:"Section unlocked"},audience:"external",required:Y_(e),args:[{key:"applicationId",type:"string",required:!0},{key:"sectionLabel",type:"localizedText",required:!0}]}],"notificationEvents"),validate:s(e=>{let n=[];e.inputs?.[Mn.flagKey]?.kind==="literal"&&Ip(e)===null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${Mn.flagKey}`,reason:{de:`[setFlag/missingFlagKey] setFlag-Knoten "${e.id}" nennt kein Merkmal (Parameter \u201EMerkmal im Formular\u201C).`,en:`[setFlag/missingFlagKey] setFlag node "${e.id}" names no flag (parameter "Flag in the form").`},severity:"error"});let r=e.inputs?.[Mn.value];return r?.kind==="literal"&&typeof r.value!="boolean"&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${Mn.value}`,reason:{de:`[setFlag/valueType] setFlag-Knoten "${e.id}": \u201ESetzen oder zur\xFCcknehmen\u201C ist ein Ja/Nein-Wert (true/false), kein Text.`,en:`[setFlag/valueType] setFlag node "${e.id}": "Raise or lower" is a yes/no value (true/false), not text.`},severity:"error"}),n},"validate")};var T8="true",R8="false",Ix=[{id:T8,label:{de:"Ja",en:"Yes"}},{id:R8,label:{de:"Nein",en:"No"}}];var pM={role:"control",effect:"pure",cardinality:"1-to-N",outcomes:Ix,validate:s((e,n,t)=>$8(e,n,t),"validate")};function $8(e,n,t){let r=s(o=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.condition`,reason:{de:`[if/condition] Knoten "${e.id}": ${o.de}`,en:`[if/condition] Node "${e.id}": ${o.en}`},severity:"error"}),"issue"),i=Ix.filter(o=>e.next?.[o.id]===void 0).map(o=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.next.${o.id}`,reason:{de:`[if/unroutedOutcome] Knoten "${e.id}": Ausgang \u201E${o.label.de}\u201C (${o.id}) f\xFChrt nirgendwohin.`,en:`[if/unroutedOutcome] Node "${e.id}": Outcome "${o.label.en}" (${o.id}) leads nowhere.`},severity:"error"}));return typeof e.condition!="string"||e.condition.trim()===""?[...i,r({de:"Bedingung fehlt.",en:"The condition is missing."})]:[...i,...hm(e.condition,BO(n),t).map(r)]}s($8,"ifNodeIssues");var Ii="decision",I8=new Set(["decision","review"]),HNe=new Set([...I8,"governedDocument"]);var hM=[{id:"approved",label:{de:"Freigeben",en:"Approve"},semantic:"granted"},{id:"rejected",label:{de:"Ablehnen",en:"Reject"},semantic:"rejected"},{id:"waitlisted",label:{de:"Auf Warteliste",en:"Waitlist"},semantic:"waitlisted"}],mM={released:{label:te("Freigegeben","Released"),tone:"green",phase:{key:"freigabe",label:te("Freigabe","Release"),scope:"node"},external:nn(te("Freigegeben","Released"),"green",te("Ihre Bewerbung wurde freigegeben","Your application has been released"),te("Wir haben Ihre Bewerbung freigegeben und melden uns mit den n\xE4chsten Schritten.","We have released your application and will be in touch with the next steps."))}},gs={role:"user-action",effect:"side-effect",outcomes:hM,progressDefaults:mM,progressEvents:Gn(mM),notificationEvents:s(e=>(e.outcomes??[]).map(n=>({id:n.id,label:n.label,audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"comment",type:"string"}]})),"notificationEvents"),actions:s(e=>[...(e.outcomes??[]).map(n=>({id:n.id,kind:"advance",outcome:n.id,label:n.label,...Qi(n.semantic)?{semantic:n.semantic}:{}})),...LC(e)],"actions"),optionalActionKinds:["spawnTasks","skipRule"],workItemTemplates:s(e=>[{key:Ii,recipient:"internal",title:e.decisionAsTask?.title??{de:"Entscheidung",en:"Decision"},unlocks:(e.outcomes??[]).map(n=>n.id).filter(n=>typeof n=="string"&&n.length>0),gatesNode:!1,advancesNode:!0,dueInDays:e.decisionAsTask?.dueInDays}],"workItemTemplates"),taskDocuments:s((e,n)=>n===Ii&&Array.isArray(e.reads)?e.reads.map(t=>({kind:"field",address:t})):[],"taskDocuments"),taskView:s((e,n)=>n===Ii?e.view:void 0,"taskView"),placelessTasks:{[Ii]:"Placed only by the node's authored `view`; a decision that names none is worked in its step wherever the decider opens it."},validate:Ox};function Ox(e,n,t){let r=[],i=e.outcomes??[];i.length===0&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes`,reason:{de:`[decision/missingOutcomes] Entscheidungs-Knoten "${e.id}" hat keine Outcomes \u2014 die Entscheidung w\xE4re niemals aufl\xF6sbar.`,en:`[decision/missingOutcomes] Decision node "${e.id}" has no outcomes \u2014 the decision could never be resolved.`},severity:"error"});let o=new Set(i.map(l=>l.id));for(let l of i){let d=l.label;(typeof d=="string"?d.trim().length>0:d!=null&&typeof d=="object"&&Object.values(d).some(p=>typeof p=="string"&&p.trim().length>0))||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes.${l.id}`,reason:{de:`[decision/outcomeMissingLabel] Outcome "${l.id}" von "${e.id}" hat keine Beschriftung \u2014 sie ist der Text des Knopfs im Cockpit.`,en:`[decision/outcomeMissingLabel] Outcome "${l.id}" of "${e.id}" has no label \u2014 it is the text of the button in the cockpit.`},severity:"error"});let u=l.semantic;u===void 0?r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes.${l.id}.semantic`,reason:{de:`[decision/outcomeSemanticMissing] Outcome "${l.id}" von "${e.id}" sagt nicht, was es bedeutet \u2014 eines von ${It.join(", ")}.`,en:`[decision/outcomeSemanticMissing] Outcome "${l.id}" of "${e.id}" does not say what it means \u2014 one of ${It.join(", ")}.`},severity:"error"}):Qi(u)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes.${l.id}.semantic`,reason:{de:`[decision/outcomeSemanticUnknown] Outcome "${l.id}" von "${e.id}" hat die Bedeutung "${String(u)}" \u2014 erlaubt: ${It.join(", ")}.`,en:`[decision/outcomeSemanticUnknown] Outcome "${l.id}" of "${e.id}" has the meaning "${String(u)}" \u2014 allowed: ${It.join(", ")}.`},severity:"error"})}for(let l of Object.keys(e.commentRequired??{}))o.has(l)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.commentRequired.${l}`,reason:{de:`[decision/commentRequiredUnknownOutcome] Unbekanntes Outcome "${l}" in commentRequired; erlaubt: ${[...o].join(", ")}`,en:`[decision/commentRequiredUnknownOutcome] Unknown outcome "${l}" in commentRequired; allowed: ${[...o].join(", ")}`},severity:"error"});let a=e.decisionAsTask?.title;return a!==void 0&&(a!==null&&typeof a=="object"&&Object.values(a).some(d=>typeof d=="string"&&d.length>0)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.decisionAsTask.title`,reason:{de:"[decision/decisionTaskMissingTitle] decisionAsTask.title ist gesetzt, aber leer \u2014 entweder einen nicht-leeren lokalisierten Text angeben oder das Feld weglassen (dann greift der Standardtitel).",en:"[decision/decisionTaskMissingTitle] decisionAsTask.title is set but empty \u2014 either give a non-empty localized text or omit the field (the default title then applies)."},severity:"error"})),r}s(Ox,"validateDecisionNode");var _x=[{id:"promoted",label:{de:"Nachger\xFCckt",en:"Moved up"}},{id:"closed",label:{de:"Warteliste geschlossen",en:"Waiting list closed"}}],gM=[{id:"complete",label:{de:"Vollst\xE4ndig",en:"Complete"}},{id:"acceptedIncomplete",label:{de:"Ohne Nachreichung abgeschlossen",en:"Closed without the missing documents"}},{id:"rejected",label:{de:"Abgelehnt",en:"Rejected"}},{id:"absage",label:{de:"Zur\xFCckgezogen",en:"Withdrawn"}}];var Px="promoted";var yM="promote",wM="Nachr\xFCcken",Qa="promoteLabel";var O8={de:wM,en:"Promote from waitlist"};function _8(e){let n=e.inputs?.[Qa];if(n===void 0||n.kind==="unset")return O8;let t=n.kind==="literal"?n.value:void 0;return Go(t)!==null&&F(`waitlist node ${e.id}: inputs.${Qa} ${JSON.stringify(n)} is not a { de, en } literal`),t}s(_8,"promoteLabelOf");var Nx={key:"warteliste",label:te("Warteliste","Waitlist"),scope:"global",track:"parked",waitlist:!0},kM={waitlisted:{label:te("Warteliste","Waitlisted"),tone:"amber",phase:Nx,external:nn(te("Warteliste","Waiting list"),"amber",te("Sie stehen auf der Warteliste","You are on the waiting list"),te("Ihre Bewerbung wurde auf die Warteliste gesetzt. Wir informieren Sie, sobald ein Platz frei wird.","Your application has been placed on the waiting list. We will let you know as soon as a place becomes available."))},promoted:{label:te("Nachger\xFCckt","Promoted"),tone:"green",phase:Nx,external:nn(te("Nachger\xFCckt","Moved up"),"green",te("Sie sind nachger\xFCckt","You have moved up"),te("Es ist ein Platz frei geworden \u2014 Ihre Bewerbung l\xE4uft weiter.","A place has become available \u2014 your application continues."))},closed:{label:te("Warteliste geschlossen","Waitlist closed"),tone:"red",phase:Nx,external:nn(te("Warteliste geschlossen","Waiting list closed"),"red",te("Die Warteliste wurde geschlossen","The waiting list has been closed"),te("Leider ist kein Platz mehr frei geworden.","Unfortunately no place has become available."))}},bM={outcomes:_x,inputs:s(()=>[{id:"waitlistOrder",label:{de:"Reihenfolge der Warteliste",en:"Waiting list order"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:rr.map(e=>({value:e,label:n_[e]}))},{id:Qa,label:{de:"Beschriftung \u201ENachr\xFCcken\u201C",en:"Label of \u201CPromote\u201D"},type:"localizedText",required:!1,inspector:"literal-only"}],"inputs"),validate:s((e,n)=>{let t=e.inputs?.[Qa];if(t?.kind==="literal"){let a=Go(t.value);if(a!==null)return[{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${Qa}`,reason:{de:`[waitlist/promoteLabelText] Die Beschriftung \u201ENachr\xFCcken\u201C von "${e.id}" braucht einen Text auf Deutsch und auf Englisch (${a}).`,en:`[waitlist/promoteLabelText] The "Promote" label of "${e.id}" needs a text in German and in English (${a}).`},severity:"error"}]}let r=Aw(e);if(r===null)return[];let i=n.nodes.filter(a=>a.type==="waitlist"&&a.id!==e.id),o=n.nodes.indexOf(e);for(let a of i){if(n.nodes.indexOf(a)>o)continue;let l=Aw(a);if(l!==null&&l.waitlistOrder!==r.waitlistOrder)return[{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs`,reason:{de:`[waitlist/policyConflict] Wartelisten "${a.id}" und "${e.id}" nennen verschiedene Reihenfolgen \u2014 alle Wartelisten eines Prozesses ordnen gleich.`,en:`[waitlist/policyConflict] Waiting lists "${a.id}" and "${e.id}" state different orders \u2014 all waiting lists of a process order alike.`},severity:"error"}]}return[]},"validate"),pausesApplicationTasks:!0,progressDefaults:kM,progressEvents:Gn(kM),notificationEvents:s(()=>[{id:"placed",label:{de:"Auf die Warteliste gesetzt",en:"Placed on the waiting list"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"rank",type:"number"}]},{id:"promoted",label:{de:"Nachger\xFCckt",en:"Promoted from the waiting list"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"rank",type:"number"}]}],"notificationEvents"),actions:s(e=>(e.outcomes!==void 0&&e.outcomes.length>0?e.outcomes:_x).some(t=>t.id===Px)?[{id:yM,kind:"advance",outcome:Px,semantic:"other",label:_8(e),surface:ar,superUserOnly:!0,teamAssignable:!0}]:[],"actions")};var Cx="complete",mc="acceptedIncomplete",Th="rejected",P8="absage",vM="closeWithoutDocuments",xM="rejectAtCompleteness",SM="Ohne Nachreichung abschlie\xDFen",AM="Ablehnen",EM="awaitingDocuments",Dx="documentsComplete",Fx="closedWithoutDocuments",Lx="rejected",Mx="withdrawn",TM="requested",wCe={[Cx]:{event:Dx,status:"complete",endsRole:!0},[mc]:{event:Fx,status:"acceptedIncomplete",endsRole:!1},[Th]:{event:Lx,status:"rejected",endsRole:!0},[P8]:{event:Mx,status:"withdrawn",endsRole:!0}};var hc=s(()=>Ql[0],"beneficiary"),qx=366;function N8(e){let n=e.reads,t=Zl(e).flatMap(({address:r})=>un(r)&&!Ql.includes(r.path)?[r]:[]);return[...Array.isArray(n)?n.filter(un):[],...t]}s(N8,"printedFields");function C8(e,n){let t=de(n);return e.nodes.filter(r=>r.type==="governedDocument"&&N8(r).some(i=>de(i)===t))}s(C8,"documentsPrinting");function D8(e,n){if(!un(n)||n.path!==hc())return!1;let t=e.nodes.find(r=>r.id===n.owner);return t!==void 0&&t.type==="form"&&!Ot(t)}s(D8,"isCreatedFormBeneficiary");function zn(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(zn,"issue");function F8(e,n,t){let r=new Map(e.nodes.map(l=>[l.id,l])),i=n.next??{},o=new Set,a=[Cx,mc].flatMap(l=>{let d=i[l]?.to;return d===void 0?[]:[d]});for(;a.length>0;){let l=a.pop();if(o.has(l))continue;o.add(l);let d=r.get(l);if(d!==void 0&&!(d.type==="review"&&we(d.form)&&ir(d.form)&&d.form.owner===t)){if(d.type==="end"){if(Yo(d)==="approved")return!0;continue}for(let c of Object.values(d.next??{}))a.push(c.to)}}return!1}s(F8,"reachesApprovedEndUnreviewed");var Kx={key:"unterlagen",label:te("Unterlagen nachreichen","Outstanding documents"),scope:"node"},RM={[EM]:{label:te("Unterlagen nachreichen","Outstanding documents"),tone:"amber",phase:Kx,external:nn(te("Unterlagen fehlen","Documents missing"),"amber",te("Bitte reichen Sie die fehlenden Unterlagen nach","Please submit the missing documents"),te("Uns fehlen noch einige Angaben oder Unterlagen. Sie finden die Liste und die Frist in Ihren Aufgaben.","Some details or documents are still missing. You will find the list and the deadline in your tasks."))},[Dx]:{label:te("Unterlagen vollst\xE4ndig","Documents complete"),tone:"green",phase:Kx,external:nn(te("Unterlagen vollst\xE4ndig","Documents complete"),"green",te("Ihre Unterlagen sind vollst\xE4ndig","Your documents are complete"),te("Alle angeforderten Unterlagen liegen uns vor. Vielen Dank.","We have received all the requested documents. Thank you."))},[Fx]:{label:te("Ohne Nachreichung abgeschlossen","Closed without documents"),tone:"neutral",phase:Kx,external:nn(te("Abgeschlossen","Closed"),"neutral",te("Die Nachreichung ist abgeschlossen","The document request is closed"),te("Wir haben die Anforderung der Unterlagen abgeschlossen. Ihre Bewerbung l\xE4uft weiter.","We have closed the document request. Your application continues."))},[Lx]:{label:te("Abgelehnt","Rejected"),tone:"red",phase:nN,external:nn(te("Abgelehnt","Rejected"),"red",te("Leider k\xF6nnen wir Ihnen keinen Platz anbieten","Unfortunately we cannot offer you a place"),te("Wir bedauern, Ihnen mitteilen zu m\xFCssen, dass wir Ihre Bewerbung nicht ber\xFCcksichtigen konnten.","We regret to inform you that we were unable to accept your application."))},[Mx]:{label:te("Zur\xFCckgezogen","Withdrawn"),tone:"red",phase:Yp,external:nn(te("Zur\xFCckgezogen","Withdrawn"),"red",te("Sie haben Ihre Bewerbung zur\xFCckgezogen","You have withdrawn your application"),te("Ihre Bewerbung wird nicht weitergef\xFChrt.","Your application will not be continued."))}},$M={outcomes:gM,progressDefaults:RM,progressEvents:Gn(RM),notificationEvents:s(()=>[{id:TM,label:{de:"Unterlagen angefordert",en:"Documents requested"},audience:"external",required:!0,args:[{key:"applicationId",type:"string",required:!0},{key:"fieldLabels",type:"localizedText",required:!0},{key:"dueAt",type:"number",required:!0}]}],"notificationEvents"),actions:s(e=>{let n=s(r=>e.next?.[r]!==void 0,"wired"),t=[];return n(mc)&&t.push({id:vM,kind:"advance",outcome:mc,semantic:"other",label:{de:SM,en:"Close without documents"},surface:ar,superUserOnly:!0,confirm:{title:{de:"Unterlagen unvollst\xE4ndig",en:"Documents incomplete"},body:{de:"Es geht ohne die fehlenden Unterlagen weiter. Die Anfrage an die Familie wird geschlossen.",en:"The application continues without the missing documents. The request to the family is closed."},confirmLabel:{de:"Abschlie\xDFen",en:"Close"}}}),n(Th)&&t.push({id:xM,kind:"advance",outcome:Th,semantic:"rejected",label:{de:AM,en:"Reject application"},surface:ar,superUserOnly:!0,confirm:{title:{de:"Unterlagen unvollst\xE4ndig",en:"Documents incomplete"},body:{de:"Der Platz wird abgesagt und die Anfrage an die Familie geschlossen. Das l\xE4sst sich nicht r\xFCckg\xE4ngig machen.",en:"The application is rejected and the request to the family is closed. This cannot be undone."},confirmLabel:{de:"Ablehnen",en:"Reject"}}}),t},"actions"),inputs:s(()=>[{id:"person",label:{de:"Person (Gasth\xF6rer-Rolle)",en:"Person (guest role)"},type:"personRef",required:!1},{id:"guestRole",label:{de:"Gastrolle bis zur Nachreichung",en:"Guest role until submitted"},type:"roleKey",required:!1,inspector:"literal-only",optionSource:"tenantRoles"}],"inputs"),validate:s((e,n,t)=>{let r=[],i=`Vollst\xE4ndigkeitspr\xFCfung \u201E${e.label?.de??e.id}\u201C (${e.id})`,o=`Completeness check "${e.label?.en||e.id}" (${e.id})`,a=s(T=>Ve(n,T,"de"),"shown"),l=s(T=>Ve(n,T,"en"),"shownEn"),d=e.requires;if(!Array.isArray(d)||d.length===0)r.push(zn(e,"requires",{de:`[completenessCheck/missingRequires] ${i} nennt keine Felder \u2014 \`requires\` muss mindestens ein Feld eines Formulars enthalten ($node.<formular>.admission.<feld>).`,en:`[completenessCheck/missingRequires] ${o} names no fields \u2014 \`requires\` must contain at least one field of a form ($node.<form>.admission.<field>).`}));else{let T=new Set;for(let E of d){if(!we(E))continue;let $=de(E);if(T.has($)){r.push(zn(e,"requires",{de:`[completenessCheck/duplicateField] Feld ${a(E)} steht doppelt in \`requires\`.`,en:`[completenessCheck/duplicateField] Field ${l(E)} appears twice in \`requires\`.`}));continue}if(T.add($),!un(E)){r.push(zn(e,"requires",{de:`[completenessCheck/unknownField] ${a(E)} ist kein Feld eines Formulars \u2014 \`requires\` nennt Felder ($node.<formular>.admission.<feld>).`,en:`[completenessCheck/unknownField] ${l(E)} is not a field of a form \u2014 \`requires\` names fields ($node.<form>.admission.<field>).`}));continue}let C=ei(t,E);if(C==null)continue;let L=fa("requires",ua(C));L==="computed"||L==="repeated"?r.push(zn(e,"requires",{de:`[completenessCheck/fieldNotRequestable] Feld ${a(E)} ist ${C.kind==="computed"?"berechnet":"ein Feld einer wiederholten Gruppe"} \u2014 die Familie kann es nicht nachreichen.`,en:`[completenessCheck/fieldNotRequestable] Field ${l(E)} is ${C.kind==="computed"?"computed":"a field of a repeated group"} \u2014 the family cannot submit it later.`})):L==="untranslated"&&r.push(zn(e,"requires",{de:`[completenessCheck/fieldNameUntranslated] Feld ${a(E)} (\u201E${to(C,"de")}") hat keinen englischen Namen (Feld oder Person/Abschnitt) \u2014 die Benachrichtigung \u201EUnterlagen angefordert" nennt es in der Sprache der Familie.`,en:`[completenessCheck/fieldNameUntranslated] Field ${l(E)} ("${to(C,"de")}") has no English name (field or person/section) \u2014 the notification "Documents requested" names it in the family's language.`}))}}let c=e.deadline,u=typeof c=="object"&&c!==null?c:{},p="inDays"in u,h="until"in u;if(p===h)r.push(zn(e,"deadline",{de:`[completenessCheck/deadlineShape] Vollst\xE4ndigkeitspr\xFCfung "${e.id}" braucht genau eine Frist: \`{ inDays: n }\` (Tage ab Eintritt) oder \`{ until: "JJJJ-MM-TT" }\`.`,en:`[completenessCheck/deadlineShape] Completeness check "${e.id}" needs exactly one deadline: \`{ inDays: n }\` (days after entry) or \`{ until: "YYYY-MM-DD" }\`.`}));else if(p){let T=u.inDays;(typeof T!="number"||!Number.isInteger(T)||T<0||T>qx)&&r.push(zn(e,"deadline.inDays",{de:`[completenessCheck/deadlineDays] Frist "${String(T)}" ist keine ganze Zahl von 0 bis ${qx} Tagen.`,en:`[completenessCheck/deadlineDays] Deadline "${String(T)}" is not a whole number from 0 to ${qx} days.`}))}else typeof u.until!="string"||wk(u.until)===null?r.push(zn(e,"deadline.until",{de:`[completenessCheck/deadlineDate] Frist "${String(u.until)}" ist kein g\xFCltiges Datum (JJJJ-MM-TT).`,en:`[completenessCheck/deadlineDate] Deadline "${String(u.until)}" is not a valid date (YYYY-MM-DD).`})):u.until<SN(Date.now())&&r.push({...zn(e,"deadline.until",{de:`[completenessCheck/deadlinePassed] Frist "${u.until}" liegt in der Vergangenheit \u2014 jede Anfrage bek\xE4me den Tag des Eintritts als Frist. Datum aktualisieren?`,en:`[completenessCheck/deadlinePassed] Deadline "${u.until}" is in the past \u2014 every request would get the day of entry as its deadline. Update the date?`}),severity:"warning"});if(Array.isArray(d)){let T=new Map(d.filter(un).map(E=>[de(E),E]));for(let E of T.values())for(let $ of C8(n,E))r.push(zn(e,"requires",{de:`[completenessCheck/requiresConsumedUpstream] Feld ${a(E)} flie\xDFt in das Dokument \u201E${$.label?.de??$.id}" (${$.id}) ein \u2014 nach dessen Ausstellung kann die Familie es nicht mehr nachreichen. Feld aus \`requires\` oder aus dem Dokument nehmen.`,en:`[completenessCheck/requiresConsumedUpstream] Field ${l(E)} flows into the document "${$.label?.en||$.id}" (${$.id}) \u2014 once it is issued, the family can no longer submit it later. Remove the field from \`requires\` or from the document.`}))}if(Array.isArray(d)&&t!==void 0){let T=d.filter(un).filter(C=>{let L=ei(t,C);return L!=null&&gm(L)}),$=[...new Set(T.map(C=>C.owner))].filter(C=>F8(n,e,C));if($.length>0){let C=T.filter(L=>$.includes(L.owner));r.push({...zn(e,"next",{de:`[review/unreviewedAfterSupply] ${C.map(a).join(", ")} ist pr\xFCfpflichtig und wird hier nachgereicht, aber nach \u201Evollst\xE4ndig\u201C oder \u201Eohne Nachreichung\u201C f\xFChrt ein Weg ohne Pr\xFCfknoten dieses Formulars zur Aufnahme \u2014 niemand pr\xFCft das Nachgereichte. Dort einen Pr\xFCfknoten einf\xFCgen (z. B. \u201EWenn nichts zu pr\xFCfen ist: Durchreichen\u201C).`,en:`[review/unreviewedAfterSupply] ${C.map(l).join(", ")} requires review and is supplied here, but after "complete" or "accepted incomplete" a path without a review node of this form leads to admission \u2014 nobody reviews what was supplied. Insert a review node there (e.g. "When nothing is owed: pass through").`}),severity:"warning"})}}let y=e.inputs?.guestRole,k=y?.kind==="literal"?y.value:void 0,w=e.inputs?.person,b=w?.kind==="binding"?w.address:null;k!==void 0&&(typeof k!="string"||k.trim()===""?r.push(zn(e,"inputs.guestRole",{de:"[completenessCheck/guestRoleEmpty] `guestRole` ist leer \u2014 Rollenschl\xFCssel angeben oder das Feld weglassen.",en:"[completenessCheck/guestRoleEmpty] `guestRole` is empty \u2014 give a role key or omit the field."})):t?.roleKeys!==void 0&&!t.roleKeys.has(k)?r.push(zn(e,"inputs.guestRole",{de:`[completenessCheck/unknownRole] Rolle "${k}" existiert nicht im Rollenkatalog des Mandanten. Bekannte Rollen: ${[...t.roleKeys].sort().join(", ")}.`,en:`[completenessCheck/unknownRole] Role "${k}" does not exist in this school's role catalog. Known roles: ${[...t.roleKeys].sort().join(", ")}.`})):t?.assignableRoleKeys!==void 0&&!t.assignableRoleKeys.has(k)&&r.push(zn(e,"inputs.guestRole",{de:`[completenessCheck/nonLeafRole] Rolle "${k}" hat untergeordnete Rollen und ist nicht vergebbar.`,en:`[completenessCheck/nonLeafRole] Role "${k}" has sub-roles and cannot be assigned.`})),b===null&&r.push(zn(e,"inputs.person",{de:`[completenessCheck/guestRoleNeedsPerson] ${i} vergibt die Rolle "${String(k)}", aber der Eingang \u201Eperson" ist nicht gebunden (z. B. an $node.<formular>.${Un}.${hc()}).`,en:`[completenessCheck/guestRoleNeedsPerson] ${o} assigns the role "${String(k)}", but the input "person" is not bound (e.g. to $node.<form>.${Un}.${hc()}).`}))),we(b)&&!D8(n,b)&&r.push(zn(e,"inputs.person",{de:`[completenessCheck/personNotFormParty] Eingang \u201Eperson" ist an ${a(b)} gebunden \u2014 die Pr\xFCfung vergibt die Rolle der Person, f\xFCr die ein Formular abgeschickt wurde ($node.<anlegender Formularknoten>.${Un}.${hc()}).`,en:`[completenessCheck/personNotFormParty] The input "person" is bound to ${l(b)} \u2014 the check assigns the role to the person a form was submitted for ($node.<creating form node>.${Un}.${hc()}).`})),b!==null&&k===void 0&&r.push(zn(e,"inputs.person",{de:'[completenessCheck/personWithoutRole] Eingang \u201Eperson" ist gebunden, aber es wird keine Rolle vergeben \u2014 die Bindung wirkt nicht.',en:'[completenessCheck/personWithoutRole] The input "person" is bound, but no role is assigned \u2014 the binding has no effect.'}));for(let T of["complete","rejected"])e.next?.[T]===void 0&&r.push(zn(e,`next.${T}`,{de:`[completenessCheck/unroutedOutcome] Vollst\xE4ndigkeitspr\xFCfung "${e.id}" leitet den Ausgang "${T}" nirgendwohin.`,en:`[completenessCheck/unroutedOutcome] Completeness check "${e.id}" routes the outcome "${T}" nowhere.`}));return r},"validate")};var L8=[{id:r_,label:{de:"Gepr\xFCft",en:"Reviewed"},semantic:"other"}],Rh=s(e=>e,"asDecision"),IM={[i_]:{label:te("Eingereicht","Submitted"),tone:"blue",phase:{key:"pruefung",label:te("In Pr\xFCfung","In review"),scope:"node"},external:nn(te("Eingereicht","Submitted"),"blue",te("Ihre Bewerbung wird gepr\xFCft","Your application is being reviewed"),te("Ihre Bewerbung ist bei uns eingegangen. Wir pr\xFCfen jetzt Ihre Unterlagen und melden uns, falls etwas fehlt.","We have received your application. We are now reviewing your documents and will get in touch if anything is missing."))}},OM={role:"user-action",effect:"side-effect",outcomes:L8,progressDefaults:IM,progressEvents:Gn(IM),notificationEvents:s(e=>gs.notificationEvents(Rh(e)),"notificationEvents"),inputs:s(()=>[{id:dr,label:{de:"Wenn nichts zu pr\xFCfen ist",en:"When nothing is owed"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:as.map(e=>({value:e,label:UD[e]}))}],"inputs"),actions:s(e=>[...gs.actions(Rh(e)).map(n=>n.kind==="advance"&&(e.outcomes??[]).length===1?{...n,label:{de:"Pr\xFCfung abschlie\xDFen",en:"Complete review"}}:n),{id:Rw,kind:"internal",label:{de:"Feld abhaken",en:"Tick field"}}],"actions"),optionalActionKinds:gs.optionalActionKinds,workItemTemplates:s(e=>gs.workItemTemplates(Rh(e)).map(n=>n.key===Ii?{...n,title:e.decisionAsTask?.title??{de:"Angaben pr\xFCfen",en:"Review the application"},unlocks:[...n.unlocks,Rw]}:n),"workItemTemplates"),taskDocuments:s(()=>[],"taskDocuments"),taskView:s((e,n)=>n===Ii&&e.form!==void 0&&ir(e.form)?{kind:"form",form:e.form.owner,view:iD}:void 0,"taskView"),placelessTasks:{[Ii]:"A review without a form has no checklist to tick; its row is finished in its step (\u201EPr\xFCfung abschlie\xDFen\u201C)."},validate:s((e,n,t)=>{let r=Ox(Rh(e),n,t);for(let c of e.outcomes??[]){let u=c.semantic;typeof u!="string"||!vp.includes(u)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes`,reason:{de:`[review/rejectingOutcome] Pr\xFCf-Knoten "${e.id}" deklariert das Outcome "${c.id}" mit der Bedeutung "${String(u)}" \u2014 eine Pr\xFCfung lehnt nicht ab und setzt nicht auf die Warteliste; das ist die Entscheidung der Freigabe bzw. \u201EBewerbung ablehnen".`,en:`[review/rejectingOutcome] Review node "${e.id}" declares the outcome "${c.id}" meaning "${String(u)}" \u2014 a review neither rejects nor waitlists; that is the decision of the approval or "Reject application".`},severity:"error"})}let i={de:`\u201E${e.label?.de??e.id}\u201C (${e.id})`,en:`"${e.label?.en||e.id}" (${e.id})`},o=e.inputs?.[dr],a=GD(e);o!==void 0&&a===null&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${dr}`,reason:{de:`[review/unknownMode] Pr\xFCf-Knoten ${i.de}: \u201EWenn nichts zu pr\xFCfen ist\u201C muss ${as.join(" oder ")} als fester Wert sein.`,en:`[review/unknownMode] Review node ${i.en}: "When nothing is owed" must be the literal ${as.join(" or ")}.`},severity:"error"});let l=a==="advance",d=e.form;if(l&&d===void 0&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.form`,reason:{de:`[review/advanceNeedsForm] Pr\xFCf-Knoten ${i.de} reicht durch, wenn nichts zu pr\xFCfen ist, nennt aber kein Formular \u2014 er w\xFCrde immer durchreichen. Nenne das Formular, dessen pr\xFCfpflichtige Felder er pr\xFCft.`,en:`[review/advanceNeedsForm] Review node ${i.en} passes through when nothing is owed but names no form \u2014 it would always pass through. Name the form whose review-required fields it checks.`},severity:"error"}),l&&(e.outcomes??[]).length!==1&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes`,reason:{de:`[review/advanceOneOutcome] Pr\xFCf-Knoten ${i.de} reicht durch, hat aber ${(e.outcomes??[]).length} Outcomes \u2014 durchgereicht wird \xFCber genau eines.`,en:`[review/advanceOneOutcome] Review node ${i.en} passes through but has ${(e.outcomes??[]).length} outcomes \u2014 it passes through over exactly one.`},severity:"error"}),we(d)&&ir(d)){let c=t?.readinessFormFieldsByFormNode?.get(d.owner);c!==void 0&&![...c.values()].some(gm)&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.form`,reason:l?{de:`[review/nothingDeclared] Pr\xFCf-Knoten ${i.de} pr\xFCft ${de(d)}, aber dieses Formular erkl\xE4rt kein Feld als pr\xFCfpflichtig \u2014 der Schritt w\xFCrde jedes Mal durchreichen. Markiere die Felder im Formular als \u201EPr\xFCfpflichtig\u201C.`,en:`[review/nothingDeclared] Review node ${i.en} reviews ${de(d)}, but that form declares no field review-required \u2014 the step would pass through every time. Mark the fields "Review required" in the form.`}:{de:`[review/nothingDeclared] Pr\xFCf-Knoten ${i.de} pr\xFCft ${de(d)}, aber dieses Formular erkl\xE4rt kein Feld als pr\xFCfpflichtig \u2014 der Schritt wartet, ohne dass etwas abzuhaken ist. Markiere die Felder im Formular als \u201EPr\xFCfpflichtig\u201C.`,en:`[review/nothingDeclared] Review node ${i.en} reviews ${de(d)}, but that form declares no field review-required \u2014 the step waits with nothing to tick. Mark the fields "Review required" in the form.`},severity:l?"error":"warning"})}return r},"validate")};var _M=["awaitingAnswer","answered"];async function PM(e,n){return(await va(e,{applicationId:n.applicationId,nodeId:n.nodeId})).filter(r=>r.templateKey===n.templateKey).some(r=>r.isOpen)?"awaitingAnswer":"answered"}s(PM,"externalRequestState");var DM=[{id:zo,label:{de:"Bezahlt",en:"Paid"}}],rDe=new Set(DM.map(e=>e.id));var M8=zo,NM=[{id:M8,kind:"advance",outcome:zo,semantic:"other",label:{de:"Zahlung eingegangen",en:"Payment received"},availableIn:["awaitingAnswer"]}],q8={id:ek,kind:"advance",outcome:zo,semantic:"other",label:{de:"Zahlungseingang best\xE4tigen",en:"Confirm payment received"},surface:ar,confirm:{title:{de:"Zahlungseingang best\xE4tigen",en:"Confirm payment received"},body:{de:"Die Geb\xFChr ist au\xDFerhalb von Plexus eingegangen. Der Schritt wird als separat bezahlt abgeschlossen, die Aufgabe der Familie schlie\xDFt mit.",en:"The fee was received outside Plexus. The step is completed as paid separately; the family's task closes with it."},confirmLabel:{de:"Best\xE4tigen",en:"Confirm"}}},K8={id:Xw,kind:"advance",outcome:zo,semantic:"other",label:{de:"Zahlung \xFCberspringen",en:"Skip payment"},surface:ar,superUserOnly:!0,confirm:{title:{de:"Zahlung \xFCberspringen",en:"Skip payment"},body:{de:"Die Geb\xFChr wird au\xDFerhalb von Plexus abgerechnet. Der Schritt wird ohne Zahlung abgeschlossen; es wird kein Betrag als bezahlt verbucht.",en:"The fee is billed outside Plexus. The step is completed without a payment; no amount is recorded as paid."},confirmLabel:{de:"\xDCberspringen",en:"Skip"}}},j8={id:Xw,kind:"advance",outcome:zo,semantic:"other",label:{de:"Ohne Online-Zahlung abschlie\xDFen",en:"Close without online payment"},surface:ar,superUserOnly:!0,availableIn:["awaitingAnswer"],confirm:{title:{de:"Ohne Online-Zahlung abschlie\xDFen",en:"Close without online payment"},body:{de:"Die Familie hat nicht online \xFCber Plexus bezahlt. Der Schritt wird ohne Online-Zahlung abgeschlossen; eine offene Zahlungsseite wird geschlossen. Bitte den Grund angeben (z. B. bar bezahlt).",en:"The family did not pay online through Plexus. The step is completed without an online payment; an open payment page is closed. Please give the reason (e.g. paid in cash)."},confirmLabel:{de:"Abschlie\xDFen",en:"Complete"}},commentRequired:!0};function jx(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(jx,"literalOf");function fo(e){let n=jx(e,ut);return Pp(n)?n:null}s(fo,"modeOrNull");function V8(e){let n=jx(e,eo);return typeof n=="string"&&n.length>0?n:null}s(V8,"articleKeyOrNull");function B8(e){let n=jx(e,or);return typeof n=="string"&&n.length>0&&n===n.trim()?n:null}s(B8,"payeeKeyOrNull");var U8={id:eo,label:{de:"Artikel",en:"Article"},type:"article",required:!0,inspector:"literal-only",optionSource:"programArticles"},G8={id:ut,label:{de:"Zahlungsweg",en:"Payment mode"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"manual",label:{de:"Manuell (\xDCberweisung an die Schule)",en:"Manual (transfer to the school)"}},{value:"online",label:{de:"Online (Stripe)",en:"Online (Stripe)"}}]},z8={id:no,label:{de:"Hinweis f\xFCr die Familie",en:"Note for the family"},type:"localizedText",required:!1,inspector:"literal-only"},W8={id:or,label:{de:"Zahlungsempf\xE4nger (Tr\xE4ger)",en:"Payee (legal entity)"},type:"legalEntity",required:!0,inspector:"literal-only",optionSource:"tenantTraeger"};function Y8(e){return[U8,G8,...fo(e)==="online"?[W8]:[],z8]}s(Y8,"collectPaymentInputs");var H8=["amount","currency","settlement"],J8={de:"Zahlungseingang best\xE4tigen",en:"Confirm payment received"},Q8={de:"Bewerbungsgeb\xFChr bezahlen",en:"Pay the application fee"};function Z8(e,n){if(fo(e)!=="online")return[];let t=B8(e);if(t===null)return[];let r=`nodes.${e.id}.inputs.${or}`,i=s(o=>({layer:"GRAPH",kind:"nodeRule",path:r,reason:o,severity:"error"}),"at");return n?.traeger!==void 0&&!n.traeger.has(t)?[i({de:`[collectPayment/unknownPayee] Zahlungsempf\xE4nger \u201E${t}" ist kein Tr\xE4ger dieses Mandanten \u2014 bekannt: ${[...n.traeger.keys()].join(", ")||"(keiner)"}.`,en:`[collectPayment/unknownPayee] Payee "${t}" is not a legal entity of this school \u2014 known: ${[...n.traeger.keys()].join(", ")||"(none)"}.`})]:n?.stripeReadyTraegerKeys!==void 0&&!n.stripeReadyTraegerKeys.has(t)?[i({de:`[collectPayment/onlineWithoutStripe] Zahlungsweg \u201Eonline" an \u201E${t}" setzt voraus, dass dieser Tr\xE4ger ein einsatzbereites Stripe-Konto hat (Administration \u2192 Integrationen \u2192 Stripe, Tr\xE4ger \u201E${t}") \u2014 sonst kann keine Familie bezahlen. Bis dahin \u201Emanual" w\xE4hlen.`,en:`[collectPayment/onlineWithoutStripe] Payment mode "online" to "${t}" requires this legal entity to have a ready Stripe account (Administration \u2192 Integrations \u2192 Stripe, legal entity "${t}") \u2014 otherwise no family can pay. Until then, choose "manual".`})]:[]}s(Z8,"payeeIssues");var CM={awaitingPayment:{label:te("Zahlung ausstehend","Awaiting payment"),tone:"amber",phase:{key:"zahlung",label:te("Zahlung","Payment"),scope:"node"},external:nn(te("Zahlung offen","Payment due"),"amber",te("Bitte begleichen Sie die Anmeldegeb\xFChr","Please pay the application fee"),te("Ihre Bewerbung l\xE4uft weiter, sobald die Zahlung bei uns eingegangen ist.","Your application continues as soon as we have received the payment."))}},FM={outputs:s(()=>[{name:M_,type:"object",label:{de:"Zahlung",en:"Payment"}}],"outputs"),role:"user-action",effect:"side-effect",inputs:s(e=>Y8(e),"inputs"),outcomes:DM,progressDefaults:CM,progressEvents:Gn(CM),notificationEvents:s(e=>fo(e)!=="online"?[]:[{id:"requested",label:{de:"Zahlung angefordert",en:"Payment requested"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"amount",type:"number",required:!0}]}],"notificationEvents"),actions:s(e=>{let n=fo(e);return n==="online"?[...NM,j8]:n==="manual"?[q8,K8]:[]},"actions"),states:_M,currentState:s((e,n)=>PM(e,{applicationId:n.applicationId,nodeId:n.node.id,templateKey:fo(n.node)==="manual"?$x:Rx}),"currentState"),placelessTasks:{[si]:"A payment has no document or form view; the team confirms it in its step's action bar."},workItemTemplates:s(e=>{let n=e,t=fo(n);return t==="manual"?[{key:si,recipient:"internal",title:J8,unlocks:[ek],advancesNode:!0},{key:$x,recipient:"external",title:Q8,unlocks:[],informational:!0,advancesNode:!1}]:t!=="online"?[]:[{key:Rx,recipient:"external",title:n.label,unlocks:NM.map(r=>r.id),advancesNode:!0}]},"workItemTemplates"),validate:s((e,n,t)=>{let r=[],i=s((d,c)=>r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${d}`,reason:c,severity:"error"}),"push");for(let d of H8)d in e&&i(d,{de:`[collectPayment/retiredField] \u201E${d}" steht nicht mehr am Zahlungsknoten \u2014 Betrag und W\xE4hrung kommen aus dem Artikel (Parameter \u201EArtikel"), der Zahlungsweg ist der Parameter \u201EZahlungsweg" (inputs.mode).`,en:`[collectPayment/retiredField] "${d}" is no longer on the payment node \u2014 amount and currency come from the article (parameter "Article"), and the payment mode is the parameter "Payment mode" (inputs.mode).`});r.push(...Z8(e,t)),fo(e)==="manual"&&e.assign?.[si]===void 0&&i("assign",{de:"[collectPayment/assign] Die Geb\xFChr wird manuell bezahlt, aber kein Team best\xE4tigt den Zahlungseingang \u2014 `assign.confirmPayment` nennt das Team.",en:"[collectPayment/assign] The fee is paid manually, but no team confirms the payment \u2014 `assign.confirmPayment` names the team."}),fo(e)===null&&i(`inputs.${ut}`,{de:`[collectPayment/invalidMode] Zahlungsweg muss einer von ${aa.join(", ")} sein (online = die Familie zahlt im Portal, manual = die Schule erh\xE4lt das Geld au\xDFerhalb von Plexus); erhalten ${JSON.stringify(e.inputs?.[ut])}.`,en:`[collectPayment/invalidMode] Payment mode must be one of ${aa.join(", ")} (online = the family pays in the portal, manual = the school receives the money outside Plexus); received ${JSON.stringify(e.inputs?.[ut])}.`});let o=e.inputs?.[no];if(o?.kind==="literal"){let d=Go(o.value);d!==null&&i(`inputs.${no}`,{de:`[collectPayment/reasonText] Der Hinweis f\xFCr die Familie braucht einen Text auf Deutsch und auf Englisch (${d}).`,en:`[collectPayment/reasonText] The note for the family needs a text in German and in English (${d}).`})}let a=V8(e);if(a===null)return i(`inputs.${eo}`,{de:'[collectPayment/missingArticle] Der Zahlungsknoten nennt keinen Artikel \u2014 unter \u201EParameter" einen einmaligen Artikel des Programms w\xE4hlen (Finanzen \u2192 Artikel).',en:'[collectPayment/missingArticle] The payment node names no article \u2014 under "Parameters" choose a one-time article of the program (Finance \u2192 Articles).'}),r;let l=`inputs.${eo}`;return t?.billingItemKeys!==void 0&&!t.billingItemKeys.has(a)?(i(l,{de:`[collectPayment/unknownArticle] Artikel \u201E${a}" \u2014 kein Artikel dieses Mandanten tr\xE4gt diesen Schl\xFCssel.`,en:`[collectPayment/unknownArticle] Article "${a}" \u2014 no article of this school has this key.`}),r):(t?.oneTimeBillingItemKeys!==void 0&&!t.oneTimeBillingItemKeys.has(a)&&i(l,{de:`[collectPayment/articleNotOneTime] Artikel \u201E${a}" ist kein einmaliger Artikel \u2014 eine Geb\xFChr nimmt nur ${nk.join(", ")}.`,en:`[collectPayment/articleNotOneTime] Article "${a}" is not a one-time article \u2014 a fee only takes ${nk.join(", ")}.`}),t?.offerProgram===null?i(l,{de:"[collectPayment/articleOfferWithoutProgram] Das Angebot ist keinem Programm zugeordnet, also geh\xF6rt kein Artikel zu ihm; dem Angebot ein Programm geben.",en:"[collectPayment/articleOfferWithoutProgram] The offer is not assigned to a program, so no article belongs to it; give the offer a program."}):t?.offerProgram?.directBillingItemKeys!==void 0&&!t.offerProgram.directBillingItemKeys.has(a)&&i(l,{de:`[collectPayment/articleNotInProgram] Artikel \u201E${a}" ist dem Programm \u201E${t.offerProgram.nameDe}" des Angebots nicht direkt zugeordnet \u2014 unter Finanzen \u2192 Artikel zuordnen (ein Paket z\xE4hlt nicht: es kann den Artikel anders bepreisen).`,en:`[collectPayment/articleNotInProgram] Article "${a}" is not directly assigned to the offer's program "${t.offerProgram.nameDe}" \u2014 assign it under Finance \u2192 Articles (a package does not count: it can price the article differently).`}),r)},"validate")};function LM(e){return{de:`[governedDocument/localeFieldMissing] Die Vorlage "${e}" nennt kein Sprachfeld \u2014 ein Schreiben entsteht in genau einer Sprache. Ein Pflicht-Auswahlfeld mit den Optionen de/en unter den Parametern der Vorlage anlegen, es als localeField der Vorlage nennen und im Knoten an die Sprache des Benutzerkontos binden ($env.applicant.language); die Word-Datei h\xE4lt je Sprache einen Abschnitt <<#input.<feld>.de>> \u2026 <</input.<feld>.de>>.`,en:`[governedDocument/localeFieldMissing] The template "${e}" names no language field \u2014 a letter is written in exactly one language. Create a required choice field with the options de/en among the template's parameters, name it as the template's localeField and bind it in the node to the language of the user account ($env.applicant.language); the Word file holds one section per language <<#input.<field>.de>> \u2026 <</input.<field>.de>>.`}}s(LM,"localeFieldMissingText");var Vx=new Set(["string","email","tel","number","date","boolean","enum","pricedItem"]),MM=/^[a-z][a-z0-9_]*$/;function qM(e,n){let t=[],r=e?.fields;if(!Array.isArray(r))return[{path:"",reason:{de:`[governedDocument/missingTemplateFields] Die Vorlage "${n}" deklariert keine Parameter \u2014 erwartet wird { fields } (die Platzhalter input.<schl\xFCssel>, die ein Knoten f\xFCllt).`,en:`[governedDocument/missingTemplateFields] The template "${n}" declares no parameters \u2014 expected { fields } (the placeholders input.<key> a node fills).`}}];let i=r,o=new Set;for(let a of i){if(typeof a?.key!="string"||!MM.test(a.key)||o.has(a.key)){t.push({path:`fields.${String(a?.key)}`,reason:{de:`[governedDocument/templateFieldKey] Feld "${String(a?.key)}" der Vorlage "${n}" ist ${o.has(a?.key)?"doppelt":"kein g\xFCltiger Schl\xFCssel"} \u2014 erlaubt sind eindeutige Kleinbuchstaben, Ziffern und _ (gedruckt als input.<schl\xFCssel>).`,en:`[governedDocument/templateFieldKey] Field "${String(a?.key)}" of the template "${n}" is ${o.has(a?.key)?"duplicated":"not a valid key"} \u2014 allowed are unique lower-case letters, digits and _ (printed as input.<key>).`}});continue}o.add(a.key);let l=`fields.${a.key}`;if(!Xi(a.type)){t.push({path:l,reason:{de:`[governedDocument/unknownFieldType] Vorlage "${n}" typisiert das Feld "${a.key}" als "${String(a.type)}" \u2014 das geh\xF6rt nicht zum Wert-Vokabular der Plattform (${sa.join(", ")}).`,en:`[governedDocument/unknownFieldType] Template "${n}" types the field "${a.key}" as "${String(a.type)}" \u2014 that is not part of the platform's value vocabulary (${sa.join(", ")}).`}});continue}if(Vx.has(a.type)||t.push({path:l,reason:{de:`[governedDocument/templateFieldType] Feld "${a.key}" der Vorlage "${n}" hat den Typ "${a.type}" \u2014 ein Dokument aus einer Vorlage druckt nur ${[...Vx].join(", ")}.`,en:`[governedDocument/templateFieldType] Field "${a.key}" of the template "${n}" has the type "${a.type}" \u2014 a document from a template only prints ${[...Vx].join(", ")}.`}}),a.type==="enum"&&Array.isArray(a.options)&&a.options.some(d=>!MM.test(String(d.value)))&&t.push({path:l,reason:{de:`[governedDocument/templateFieldKey] Auswahlfeld "${a.key}" der Vorlage "${n}" hat Optionen, die kein Platzhalter adressieren kann (${a.options.map(d=>d.value).join(", ")}) \u2014 Optionswerte sind Kleinbuchstaben, Ziffern und _ (gedruckt als input.${a.key}.<option>).`,en:`[governedDocument/templateFieldKey] Select field "${a.key}" of the template "${n}" has options no placeholder can address (${a.options.map(d=>d.value).join(", ")}) \u2014 option values are lower-case letters, digits and _ (printed as input.${a.key}.<option>).`}}),a.type==="enum"&&(!Array.isArray(a.options)||a.options.length===0)&&t.push({path:l,reason:{de:`[governedDocument/templateFieldOptions] Auswahlfeld "${a.key}" der Vorlage "${n}" nennt keine Optionen \u2014 ohne sie gibt es keine Abschnitte input.${a.key}.<option>.`,en:`[governedDocument/templateFieldOptions] Select field "${a.key}" of the template "${n}" names no options \u2014 without them there are no sections input.${a.key}.<option>.`}}),a.type==="pricedItem"){let d=i.find(c=>c.key===a.priceDate);(d===void 0||d.type!=="date")&&t.push({path:l,reason:{de:`[governedDocument/templateFieldPriceDate] Preisfeld "${a.key}" der Vorlage "${n}" nennt kein Preisdatum \u2014 priceDate muss ein Datumsfeld derselben Vorlage sein (welche Preisversion gilt); genannt: ${JSON.stringify(a.priceDate)}.`,en:`[governedDocument/templateFieldPriceDate] Price field "${a.key}" of the template "${n}" names no price date \u2014 priceDate must be a date field of the same template (which price version applies); named: ${JSON.stringify(a.priceDate)}.`}})}else a.priceDate!==void 0&&t.push({path:l,reason:{de:`[governedDocument/templateFieldPriceDate] Feld "${a.key}" setzt priceDate, ist aber kein Preisfeld (pricedItem).`,en:`[governedDocument/templateFieldPriceDate] Field "${a.key}" sets priceDate but is not a price field (pricedItem).`}});a.processSource==="countersignature"?t.push({path:l,reason:{de:`[governedDocument/countersignatureInTemplate] Feld "${a.key}" wird bei einer Gegenzeichnung gesetzt \u2014 ein Dokument aus einer Vorlage wird nicht gegengezeichnet.`,en:`[governedDocument/countersignatureInTemplate] Field "${a.key}" is set at a countersignature \u2014 a document from a template is not countersigned.`}}):a.processSource!==void 0&&!Tm.includes(a.processSource)&&t.push({path:l,reason:{de:`[governedDocument/unknownProcessSource] Feld "${a.key}" nennt die unbekannte Vorgangsquelle "${String(a.processSource)}" \u2014 bekannt sind ${Tm.join(", ")}.`,en:`[governedDocument/unknownProcessSource] Field "${a.key}" names the unknown case source "${String(a.processSource)}" \u2014 known are ${Tm.join(", ")}.`}})}return t.push(...X8(e,n)),t}s(qM,"templateParameterIssues");function X8(e,n){if(e.localeField===void 0)return[{path:"localeField",reason:LM(n)}];let t=e.fields.find(i=>i.key===e.localeField),r=t===void 0?{de:"nennt kein Feld der Vorlage",en:"names no field of the template"}:t.type!=="enum"?{de:`ist ${t.type}, erwartet wird ein Auswahlfeld (enum)`,en:`is ${t.type}, a select field (enum) is expected`}:t.required!==!0?{de:"ist kein Pflichtfeld \u2014 ohne Sprache gibt es keine Variante",en:"is not a required field \u2014 without a language there is no variant"}:(t.options??[]).length===0?{de:"hat keine Optionen",en:"has no options"}:(t.options??[]).some(i=>!Be.includes(i.value))?{de:`hat Optionen, die keine Sprache sind (erlaubt: ${Be.join(", ")})`,en:`has options that are not a language (allowed: ${Be.join(", ")})`}:null;return r===null?[]:[{path:"localeField",reason:{de:`[governedDocument/localeField] Das Sprachfeld "${e.localeField}" der Vorlage "${n}" ${r.de}.`,en:`[governedDocument/localeField] The language field "${e.localeField}" of the template "${n}" ${r.en}.`}}]}s(X8,"localeFieldIssues");function KM(e,n){if(n===null){delete e.templateStamp;return}e.templateStamp={fields:structuredClone(n.fields),...n.localeField===void 0?{}:{localeField:n.localeField}}}s(KM,"applyTemplateStamp");var Bx=50;async function $h(e,n){let t=await e.db.query("signing_returns").withIndex("by_signingRequestId",r=>r.eq("signingRequestId",n)).take(Bx+1);return t.length>Bx&&F(`signing_returns: Vorgang ${n} has more than ${Bx} returns`),t}s($h,"returnsOf");var Ux=50;async function Gx(e,n){let t=await e.db.query("signing_return_documents").withIndex("by_signingReturnId_and_order",r=>r.eq("signingReturnId",n)).take(Ux+1);return t.length>Ux&&F(`signing_returns: return ${n} has more than ${Ux} files`),t.length===0&&F(`[signing/noDocument] return ${n} carries no file`),t}s(Gx,"returnDocumentsOf");async function jM(e,n){let t=await Gx(e,n);return t.length!==1&&F(`[signing/severalDocuments] return ${n} carries ${t.length} files; this reader handles one`),t[0]}s(jM,"soleReturnDocumentOf");var Ih=200,SDe=Ih*20;async function eZ(e,n){let t=await e.db.get(n);return t===null&&F(`[process] application ${n} not found`),t.redactedAt!==void 0}s(eZ,"processRedacted");async function zx(e,n){await eZ(e,n)&&ae("CONFLICT",{de:"Die Daten dieser Bewerbung wurden gel\xF6scht.",en:"The data of this application has been deleted."})}s(zx,"assertProcessReadable");function nZ(e){let n={_id:e._id,_creationTime:e._creationTime,owner:e.owner,key:e.key};return e.scope==="task"?{...n,scope:"task",result:{kind:"value",value:e.value},writtenByTaskId:e.writtenByTaskId}:{...n,scope:"node",result:e.result}}s(nZ,"rowOf");async function VM(e,n,t){await zx(e,n);let r=await e.db.query("process_store_entries").withIndex("by_applicationId_and_scope_and_owner_and_key",i=>i.eq("applicationId",n).eq("scope",t.scope).eq("owner",t.owner).eq("key",t.key)).order("desc").take(Ih+1);return r.length>Ih&&F(`[process] application ${n} has more than ${Ih} results of ${t.scope}.${t.owner}.${t.key}`),r.map(nZ)}s(VM,"storeHistory");async function tZ(e,n,t){if(t.key===Un){await zx(e,n);let i=await e.db.query("smart_form_instances").withIndex("by_applicationId_and_formNodeId",o=>o.eq("applicationId",n).eq("formNodeId",t.owner)).unique();return i===null||i.state!=="committed"?{state:"pending",reason:null}:{state:"present",result:{kind:"ref",ref:{kind:"form",formInstanceId:i._id}},row:null}}let[r]=await VM(e,n,{scope:"node",owner:t.owner,key:t.key});return r===void 0?{state:"pending",reason:null}:{state:"present",result:r.result,row:r}}s(tZ,"nodeResultAt");async function Oh(e,n){let t={scope:"node",owner:n.nodeId,key:n.key};return rZ(await tZ(e,n.applicationId,t),t,n.applicationId)}s(Oh,"readOwnResult");function rZ(e,n,t){return e.state!=="present"?{state:"pending"}:(e.result.kind!=="ref"&&F(`[process] ${de(n)} of application ${t} holds a value \u2014 this address holds a ref`),{state:"ref",ref:e.result.ref,row:e.row})}s(rZ,"refOf");var Wx={pending:"open",sent:"open",partially_signed:"open",completed:"terminal",declined:"terminal",voided:"terminal",expired:"terminal",failed:"terminal"},iZ=Object.keys(Wx),oZ=iZ.filter(e=>Wx[e]==="open"),PDe=oZ.filter(e=>e!=="pending");function BM(e){return Wx[e]==="terminal"}s(BM,"isTerminalSigningStatus");var po=["docusign","insign"];var gc={docusign:"DocuSign",insign:"inSign",manual:"Auf Papier",simulated:"Simuliert (Testmodus)"};var aZ=BM;function GM(e){return!aZ(e.status)&&e.voidRequestedAt===void 0}s(GM,"holdsContract");async function zM(e,n){return await e.db.query("legal_entities").withIndex("by_partyId",t=>t.eq("partyId",n)).unique()}s(zM,"traegerLegalEntityOfParty");async function lZ(e,n){return await e.db.query("organizations").withIndex("by_partyId",r=>r.eq("partyId",n)).first()!==null}s(lZ,"isOrganizationParty");async function WM(e,n){return await zM(e,n)!==null?"traeger":await lZ(e,n)?"organization":"person"}s(WM,"signerKindOf");async function YM(e,n){n.length===0&&F("signingSideOf: a Vorgang without signers asks nobody");for(let t of n)if(await dZ(e,t.partyId)==="family")return"family";return"traeger"}s(YM,"signingSideOf");async function dZ(e,n){return await WM(e,n)==="traeger"?"traeger":"family"}s(dZ,"sideOfParty");var gFe=m.object({key:m.string(),name:m.object({de:m.string(),en:m.string()}),billingItemDefinitionIds:m.array(m.id("billing_item_definitions"))}),JM=m.object({key:m.string(),name:m.object({de:m.string(),en:m.string()})});var Yx=m.union(m.literal("month"),m.literal("year"),m.literal("once"),m.literal("unit")),_h=m.object({period:Yx,anchorDate:m.string()});var vFe=m.union(m.object({percent:m.number()}),m.object({amountMinor:m.number()})),xFe=m.union(m.literal("line"),m.literal("aggregate")),Ph=m.record(m.string(),m.string());var cZ=m.union(m.literal("active"),m.literal("ended")),Hx=m.union(m.object({mode:m.literal("track")}),m.object({mode:m.literal("pin"),billingItemVersionId:Ue.restrict(m.id("billing_item_versions"),{unindexed:"pinned price version inside the pricing union"})}),m.object({mode:m.literal("override"),amount:m.number()})),uZ=m.union(m.object({anchor:m.literal("enrollment")}),m.object({anchor:m.literal("manual"),activeFrom:m.string(),activeTo:m.optional(m.string())})),fZ={contractId:Ue.belongsTo(m.id("contracts")),billingItemDefinitionId:Ue.restrict(m.id("billing_item_definitions")),pricing:Hx,pricingSelections:m.optional(Ph),paymentSchedule:m.optional(_h),resolvedSnapshot:m.any(),feeGroup:m.optional(JM),generationRunId:m.optional(Ue.history(m.id("contract_generation_runs")))},pZ={...fZ,period:uZ,enrollmentPeriodBaseline:m.optional(m.string()),enrollmentReconciliations:m.optional(m.record(m.string(),m.object({basis:m.string(),evidence:m.string()}))),status:cZ,enrollmentContextId:m.optional(Ue.restrict(m.id("enrollments")))},OFe=Kt(pZ).index("by_contractId",["contractId"]).index("by_billingItemDefinitionId",["billingItemDefinitionId"]).index("by_enrollmentContextId",["enrollmentContextId"]).index("by_contractId_and_status",["contractId","status"]);var Pr=m.union(m.string(),m.null()),QM=m.object({partyId:m.id("parties"),role:m.string(),nameAtSigning:m.string()}),mZ=m.object({partyId:m.id("parties"),role:m.string(),nameAtSigning:m.string(),representative:m.optional(m.object({userId:m.id("users"),nameAtSigning:m.string(),email:m.string()}))}),ZM=m.object({sourceAllocationId:m.id("payer_allocations"),scope:m.union(m.object({kind:m.literal("contract")}),m.object({kind:m.literal("contract_line"),contractLineId:m.id("contract_lines")})),payer:m.union(m.object({kind:m.literal("party"),partyId:m.id("parties"),nameAtSigning:m.string()}),m.object({kind:m.literal("payment_method"),paymentMethodId:m.id("payment_methods"),label:m.string(),ownersAtSigning:m.array(QM)})),sharePct:m.union(m.number(),m.null()),flatAmount:m.union(m.number(),m.null()),cap:m.union(m.number(),m.null()),activeFrom:m.string(),activeTo:Pr}),XM=m.object({sourceAppliedGrantId:m.string(),sourceGrantTemplateId:m.union(m.string(),m.null()),name:m.string(),reason:m.string(),kind:m.string(),value:m.number(),rule:m.optional(m.any()),scope:m.optional(m.union(m.literal("line"),m.literal("aggregate"))),floorTotal:m.optional(m.number()),pricePeriod:m.optional(Yx),eligibleBillingItemDefinitionIds:m.optional(m.array(m.id("billing_item_definitions"))),eligibleContractLineIds:m.optional(m.array(m.id("contract_lines"))),activeFrom:m.string(),activeTo:Pr,status:m.string(),qualifyingEnrolmentId:m.union(m.id("enrollments"),m.null()),eligibilityRuleOpaque:m.any(),eligibilityEvidenceOpaque:m.any()}),hZ={sourceContractLineId:m.id("contract_lines"),status:m.string(),activeFrom:m.string(),activeTo:Pr,pricing:Hx,paymentSchedule:m.optional(_h),pricingSelections:m.optional(Ph),billingItemDefinition:m.object({sourceBillingItemDefinitionId:m.id("billing_item_definitions"),name:m.string(),itemType:m.string(),configOpaque:m.any()}),resolvedSnapshotOpaque:m.any(),enrolment:m.union(m.object({sourceEnrolmentId:m.id("enrollments"),status:m.string(),startDate:Pr,endDate:Pr,studentPartyId:m.id("parties"),studentNameAtSigning:m.string(),unitName:Pr,programName:Pr,runName:Pr,groupName:Pr}),m.null()),grants:m.array(XM),payerAllocations:m.array(ZM)},gZ=m.object({...hZ,resolvedPrice:m.object({amount:m.number(),currency:m.string(),sourceBillingItemVersionId:m.union(m.id("billing_item_versions"),m.null()),sourceValidFrom:Pr,sourceValidTo:Pr})}),yZ=m.object({formatVersion:m.literal(2),contract:m.object({scope:m.string(),generator:m.object({sourceGeneratorDefinitionId:m.id("contract_generator_definitions"),sourceCreationTime:m.number(),name:m.string(),bodyOpaque:m.any()})}),parties:m.array(QM),declaredSigners:m.array(mZ),payerAllocations:m.array(ZM),aggregateGrants:m.optional(m.array(XM)),lines:m.array(gZ)}),wZ=yZ;var kZ=m.object({left:m.number(),top:m.number(),width:m.number(),height:m.number()}),bZ=m.object({pageCount:m.number(),spots:m.array(m.object({signer:m.union(m.object({kind:m.literal("party"),role:m.string(),ordinal:m.union(m.number(),m.null())}),m.object({kind:m.literal("named"),label:$i})),caption:m.string(),page:m.number(),box:kZ}))});var vZ=m.object({storageId:Ue.holds(m.id("_storage")),sourceArtifactId:m.optional(Ue.history(m.id("admission_documents"))),sha256:m.string(),mimeType:m.optional(m.string()),sizeBytes:m.optional(m.number()),filename:m.string(),source:m.union(m.object({kind:m.literal("uploaded")}),m.object({kind:m.literal("machine_rendered"),rendererVersion:m.string(),renderInput:m.record(m.string(),m.any()),signaturePlacement:m.optional(bZ)}))}),xZ=m.object({storageId:Ue.holds(m.id("_storage")),sha256:m.string(),filename:m.string(),rendererVersion:m.string(),renderInput:m.record(m.string(),m.any()),confirmationRequired:m.boolean()}),SZ={importedTemplateSource:m.optional(m.object({id:m.string(),creationTime:m.number()})),tenantId:Ue.tenant(m.id("tenants")),contractId:Ue.restrict(m.id("contracts")),snapshotNumber:m.optional(m.number()),revisionNumber:m.optional(m.number()),supersedesSnapshotId:m.optional(Ue.history(m.id("contract_snapshots"))),frozenAt:m.number(),frozenByUserId:m.optional(Ue.history(m.id("users"))),document:vZ,coverLetter:m.optional(xZ),snapshot:Ue.historyOf(wZ),generation:m.optional(m.object({generatorVersionId:m.optional(Ue.history(m.id("contract_generator_versions"))),generatorRevisionId:m.optional(m.string()),implementationKey:m.string(),implementationChecksum:m.string(),input:m.any(),output:m.any()}))},qFe=Kt(SZ).index("by_tenantId",["tenantId"]).index("by_document_storageId",["document.storageId"]).index("by_coverLetter_storageId",["coverLetter.storageId"]).index("by_contractId_and_snapshotNumber",["contractId","snapshotNumber"]).index("by_supersedesSnapshotId",["supersedesSnapshotId"]).index("by_generation_generatorVersionId",["generation.generatorVersionId"]);var XFe=16*1024;var eLe=15*6e4;var nLe=10*6e4;var Jx={contractSnapshotId:Ue.restrict(m.id("contract_snapshots")),storageId:Ue.restrict(m.id("_storage")),sha256:m.string(),filename:m.string(),uploadedAt:m.number(),signers:m.array(m.object({partyId:Ue.history(m.id("parties")),role:m.string()}))},wLe=Kt({tenantId:Ue.tenant(m.id("tenants")),signingRequestDocumentId:Ue.belongsTo(m.id("signing_request_documents")),...Jx}).index("by_tenantId",["tenantId"]).index("by_signingRequestDocumentId",["signingRequestDocumentId"]).index("by_contractSnapshotId",["contractSnapshotId"]).index("by_storageId",["storageId"]);var SLe=m.object(Jx);var Qx=200;async function AZ(e,n,t,r){n.length>Qx&&F(`${r} is carried by more than ${Qx} signing requests`);let i=[],o=new Set;for(let l of n){if(o.has(l.signingRequestId))continue;o.add(l.signingRequestId);let d=await e.db.get(l.signingRequestId);d===null&&F(`signing_request_documents ${l._id} names a missing signing request ${l.signingRequestId}`),i.push(d)}let a=t==="asc"?1:-1;return i.sort((l,d)=>a*(l._creationTime-d._creationTime))}s(AZ,"requestsOfMembers");async function eq(e,n,t="asc"){let r=await e.db.query("signing_request_documents").withIndex("by_contractSnapshotId",i=>i.eq("contractSnapshotId",n)).take(Qx+1);return await AZ(e,r,t,`revision ${n}`)}s(eq,"requestsOfSnapshot");var nq=100;async function EZ(e,n){let t=await eq(e,n);t.length>nq&&F(`requestsBySideOf: revision ${n} has more than ${nq} Vorg\xE4nge`);let r={family:[],traeger:[]};for(let i of t.sort((o,a)=>o._creationTime-a._creationTime))r[await YM(e,i.signers)].push(i);return r}s(EZ,"requestsBySideOf");async function Zx(e,n){return(await EZ(e,n)).family}s(Zx,"familyRequestsOf");var Xx=100;async function TZ(e,n){let t=await e;return t.length>Xx&&F(`contractChain: more than ${Xx} ${n}`),t}s(TZ,"bounded");async function RZ(e,n,t){let r=await Oh(e,{applicationId:n,nodeId:t,key:Rp});return r.state==="pending"?null:(r.ref.kind!=="contract"&&F(`contractChain: $node.${t}.${Rp} of application ${n} is a ${r.ref.kind} ref \u2014 the contract chain writes a contract ref`),r.ref.contractId)}s(RZ,"nodeContractRef");async function tq(e,n){return await TZ(e.db.query("contract_snapshots").withIndex("by_contractId_and_snapshotNumber",t=>t.eq("contractId",n)).take(Xx+1),`revisions on contract ${n}`)}s(tq,"snapshotsAsc");async function eS(e,n){let t=(await Zx(e,n)).filter(GM);return t.length>1&&F(`contractChain: revision ${n} has ${t.length} open family Vorg\xE4nge`),t[0]??null}s(eS,"openFamilyRequest");async function $Z(e,n){for(let t of await tq(e,n))if((await Zx(e,t._id)).some(r=>r.provider==="manual"))return"paper";return"provider"}s($Z,"familyRoute");async function rq(e,n){for(let t of n)if(await $Z(e,t)==="paper")return"paper";return"provider"}s(rq,"familyRouteOf");async function IZ(e,n){let t=await jM(e,n._id),r=await e.db.system.get("_storage",t.storageId);return r===null&&F(`contractChain: return ${n._id} holds missing file ${t.storageId}`),{_id:n._id,_creationTime:n._creationTime,storageId:t.storageId,filename:t.filename,...r.contentType!==void 0?{mimeType:r.contentType}:{},round:n._id}}s(IZ,"toReturn");function Nh(e){async function n(a,l){return await RZ(a,l,e.id)}s(n,"contractOrNull");async function t(a,l,d,c){let u=a.db.normalizeId("contract_snapshots",d),p=u===null?null:await a.db.get(u),h=await n(a,l);return(p===null||h===null||p.contractId!==h)&&F(`${c}: ${d} is no revision of node "${e.id}"'s contract ${h??"(none yet)"} \u2014 corrupt arc`),p}s(t,"snapshotOf");async function r(a,l){let d=await n(a,l);return d===null?null:(await tq(a,d)).at(-1)??null}return s(r,"newestSnapshot"),{reads:{kind:"contract",async returned(a,l,d){if(d.askedAbout===void 0){if(d.onUnpinned==="notReturned")return null;F(`returned(${d.where}): an ask of the contract chain is always pinned to its revision`)}let c=await t(a,l,d.askedAbout,`returned(${d.where})`),u=await eS(a,c._id);if(u===null)return null;let p=(await $h(a,u._id)).filter(h=>h.review.status==="pending"&&h._id!==d.rejected);return p.length>1&&F(`returned(${d.where}): Vorgang ${u._id} has ${p.length} returns pending \u2014 one is checked at a time`),p[0]===void 0?null:await IZ(a,p[0])},pinOf(a){return a.contractSnapshotId},returnPinOf(a){return a.signingReturnId}},contractOrNull:n,snapshotOf:t,newestSnapshot:r,contractsOf:{async contractsOf(a,l){let d=await n(a,l);return d===null?[]:[d]}}.contractsOf}}s(Nh,"contractNodeReads");function Ch(e){return e.addedParts??[]}s(Ch,"addedPartsOf");var nS=50;async function OZ(e,n){let t=await e.db.query("contract_generation_runs").withIndex("by_packageRunId",r=>r.eq("packageRunId",n)).take(nS+1);return t.length>nS&&F(`groupRunsOf: generation group ${n} has more than ${nS} runs`),t.length===0&&F(`groupRunsOf: generation group ${n} has no run`),t.sort((r,i)=>r._creationTime-i._creationTime)}s(OZ,"groupRunsOf");async function iq(e,n){let t=await OZ(e,n),r=t[0].packageRunId;if(r!==void 0){(t.some(l=>l.packageRunId!==r||l.partKey===void 0)||new Set(t.map(l=>l.partKey)).size!==t.length)&&F(`groupRunsInOrder: package group ${n} has inconsistent members`);let i=await e.db.get(r);i===null&&F(`groupRunsInOrder: package run ${n} is missing`);let o=await e.db.query("contract_package_parts").withIndex("by_packageVersionId_and_position",l=>l.eq("packageVersionId",i.packageVersionId)).take(51),a=[...o.map(l=>l.partKey),...Ch(i).map(l=>l.partKey)];return(o.length>50||t.some(l=>!a.includes(l.partKey)))&&F(`groupRunsInOrder: package group ${n} names an unknown part`),t.sort((l,d)=>a.indexOf(l.partKey)-a.indexOf(d.partKey))}F(`Package run ${n} has no package reference.`)}s(iq,"groupRunsInOrder");function oq(e){return e.every(n=>n.status==="succeeded"&&n.contractId!==void 0&&n.contractSnapshotId!==void 0)}s(oq,"isCompleteGroup");var tS=200;function _Z(e){let n=e.generatorStamp?.parts;return n===void 0&&F(`groupChain: node "${e.id}" names no combined generator \u2014 only a combined generator keeps a group chain`),n.map(t=>t.partKey)}s(_Z,"groupPartKeys");async function PZ(e,n,t){let r=await e.db.query("contract_generation_runs").withIndex("by_applicationId_and_workflowNodeId",i=>i.eq("applicationId",n).eq("workflowNodeId",t)).take(tS+1);return r.length>tS&&F(`groupChain: more than ${tS} generation runs on node ${t}`),r}s(PZ,"nodeRuns");async function NZ(e,n,t){let r=_Z(t),i=new Set;for(let a of await PZ(e,n,t.id))a.packageRunId===void 0&&F(`groupChain: run ${a._id} on the combined node "${t.id}" carries no generation group`),i.add(a.packageRunId);let o=[];for(let a of i){let l=await iq(e,a);if(!oq(l))continue;let d=await e.db.get(a);d===null&&F(`groupChain: generation group ${a} has no package run`);let c=new Set(Ch(d).map(p=>p.partKey)),u=[];for(let p of l){!r.includes(p.partKey)&&!c.has(p.partKey)&&F(`groupChain: run ${p._id} renders part "${p.partKey}", which node "${t.id}"'s pin does not declare and nobody added`);let h=await e.db.get(p.contractSnapshotId);h===null&&F(`groupChain: run ${p._id} names revision ${p.contractSnapshotId}, which is gone \u2014 a deleted draft lets its run go first`),u.push({run:p,snapshot:h})}o.push({packageRunId:a,startedAt:Math.min(...l.map(p=>p._creationTime)),members:u})}return o.sort((a,l)=>a.startedAt-l.startedAt)}s(NZ,"groupRevisionRows");async function rS(e,n,t){let r=await Oh(e,{applicationId:n,nodeId:t,key:$p});return r.state==="pending"?[]:(r.ref.kind!=="contracts"&&F(`groupChain: $node.${t}.${$p} of application ${n} is a ${r.ref.kind} ref \u2014 the group chain writes a contracts ref`),[...r.ref.contracts])}s(rS,"nodeGroupContracts");async function CZ(e,n){let t=new Map;for(let{snapshot:r}of n.members){let i=await eS(e,r._id);i!==null&&t.set(i._id,i)}return t.size>1&&F(`groupChain: generation group ${n.packageRunId} is held by ${t.size} family Vorg\xE4nge \u2014 one Vorgang carries the group`),[...t.values()][0]??null}s(CZ,"openGroupRequest");async function DZ(e,n){let t=[];for(let i of await Gx(e,n._id)){let o=await e.db.system.get("_storage",i.storageId);o===null&&F(`groupChain: return ${n._id} holds missing file ${i.storageId}`),t.push({contractSnapshotId:i.contractSnapshotId,storageId:i.storageId,filename:i.filename,...o.contentType!==void 0?{mimeType:o.contentType}:{}})}let r=t[0];return{_id:n._id,_creationTime:n._creationTime,storageId:r.storageId,filename:r.filename,...r.mimeType!==void 0?{mimeType:r.mimeType}:{},round:n._id,documents:t}}s(DZ,"toGroupReturn");function sq(e){async function n(i,o,a,l){let d=(await NZ(i,o,e)).find(c=>c.members[0]?.snapshot._id===a);return d===void 0&&F(`${l}: ${a} is no revision of node "${e.id}"'s generation groups \u2014 corrupt arc`),d}return s(n,"revisionRowOf"),{reads:{kind:"group",async returned(i,o,a){if(a.askedAbout===void 0){if(a.onUnpinned==="notReturned")return null;F(`returned(${a.where}): an ask of the group chain is always pinned to its lead revision`)}let l=await n(i,o,a.askedAbout,`returned(${a.where})`),d=await CZ(i,l);if(d===null)return null;let c=(await $h(i,d._id)).filter(u=>u.review.status==="pending"&&u._id!==a.rejected);return c.length>1&&F(`returned(${a.where}): Vorgang ${d._id} has ${c.length} returns pending \u2014 one is checked at a time`),c[0]===void 0?null:await DZ(i,c[0])},pinOf(i){return i.contractSnapshotId},returnPinOf(i){return i.signingReturnId}},revisionRowOf:n,contractsOf:{async contractsOf(i,o){return(await rS(i,o,e.id)).map(a=>a.contractId)}}.contractsOf}}s(sq,"groupNodeReads");async function FZ(e,n){let t=n.lifecycle.kind==="draft"?void 0:n.lifecycle.kind;return{_id:n._id,_creationTime:n._creationTime,versionNumber:n.versionNumber,...t!==void 0?{status:t}:{},origin:n.origin.kind,storageId:n.storageId,...await Ub(e,n.storageId),...n.filename!==void 0?{filename:n.filename}:{}}}s(FZ,"toRevision");async function LZ(e,n){let t=await FZ(e,n);return{_id:t._id,_creationTime:t._creationTime,storageId:t.storageId,...t.filename!==void 0?{filename:t.filename}:{},...t.mimeType!==void 0?{mimeType:t.mimeType}:{},round:t.versionNumber}}s(LZ,"toReturn");function aq(e){let n=Om(e);async function t(o,a){return await o.db.query("admission_documents").withIndex("by_applicationId_and_slotKey_and_versionNumber",l=>l.eq("applicationId",a).eq("slotKey",n)).collect()}return s(t,"contentRowsAsc"),{reads:{kind:"artifact",async returned(o,a,l){if(l.askedAbout===void 0){if(l.onUnpinned==="notReturned")return null;ae("CONFLICT",{de:"Die offene Antwort-Aufgabe ist an keine Dokumentversion gebunden, daher l\xE4sst sich die unterschriebene Fassung nicht vom versandten Dokument unterscheiden. Stellen Sie das Dokument neu aus (Zur\xFCckziehen & neu ausstellen).",en:"The open response task is not bound to a document version, so the signed copy cannot be told apart from the document that was sent. Issue the document again (withdraw and reissue)."})}let d=await t(o,a),c=d[d.length-1];if(c===void 0||c._id===l.askedAbout||c.origin.kind!=="uploaded")return null;if(l.rejected!==void 0){let u=d.find(p=>p._id===l.rejected);if(u===void 0&&F(`returned(${l.where}): the handed-back scan ${l.rejected} is no version of slot "${n}"`),c.versionNumber<=u.versionNumber)return null}return await LZ(o,c)},pinOf(o){return o.artifactVersionId},returnPinOf(o){return o.artifactVersionId}},contentRowsAsc:t,contractsOf:{async contractsOf(){return[]}}.contractsOf}}s(aq,"artifactNodeReads");function Dh(e){return e.production==="none"&&F(`documentChainKind: node "${e.id}" has production 'none' \u2014 it keeps no document`),e.production!=="resolver"?"artifact":e.generatorStamp?.parts!==void 0?"group":"contract"}s(Dh,"documentChainKind");function lq(e){switch(Dh(e)){case"contract":return Nh(e).reads;case"group":return sq(e).reads;case"artifact":return aq(e).reads}}s(lq,"documentReadsFor");var MZ={de:"Haben Sie die Vertragsbedingungen gelesen und verstanden?",en:"Have you read and understood the contract terms?"};function yc(e){let n=e.responseStrategy;return typeof n=="string"&&n in Ai?Ai[n].producesResponseArtifact:!1}s(yc,"returnsSignedCopy");function qZ(e){return yc(e)&&e.confirmContractTerms!==!1}s(qZ,"asksContractTerms");function dq(e){return qZ(e)?{title:e.contractTermsQuestionText??MZ,body:{de:"Die unterschriebene Fassung wird erst nach Ihrer Best\xE4tigung hochgeladen. Die Best\xE4tigung wird mit Zeitpunkt und Person festgehalten.",en:"The signed copy is uploaded only after you confirm. The confirmation is recorded with time and person."},confirmLabel:{de:"OK",en:"OK"}}:null}s(dq,"contractTermsConfirm");function cq(e){let n=KZ(e);return n.length>0&&n.every(t=>t.status==="blocked")}s(cq,"producerWindowHeld");function KZ(e){return e.filter(n=>n.isOpen&&n.kind==="admission"&&n.templateKey!==void 0&&bd.has(n.templateKey))}s(KZ,"openProducerRows");async function jZ(e,n,t){if(t.revisesWorkItemId===void 0)return;let r=await e.db.get(t.revisesWorkItemId),i=r===null?null:Ok(r),o=i?.context,a=o?.kind==="admission"?n.returnPinOf(o):void 0;return(i===null||o===void 0||o.kind!=="admission"||i.templateKey!==ri||i.status!=="done"||i.outcome!=="rejected"||a===void 0)&&F(`rejectedReturnOfAsk: ask ${t._id} revises ${t.revisesWorkItemId}, which is not a rejected, pinned ${ri} row`),a}s(jZ,"rejectedReturnOfAsk");async function uq(e,n){return await n.chain.returned(e,n.applicationId,{askedAbout:n.chain.pinOf(n.ask),rejected:await jZ(e,n.chain,n.ask),onUnpinned:n.onUnpinned,where:n.where})}s(uq,"returnedCopyOfAsk");var iS=new Set([...bd,Ir,ns,co,ri,ft]),gq={id:Qn,type:"contractGenerator",label:{de:"Vertragsgenerator",en:"Contract generator"},required:!0,inspector:"literal-only",optionSource:"tenantGenerators"},yq={id:Lo,type:"documentTemplate",label:{de:"Dokumentvorlage",en:"Document template"},required:!0,inspector:"literal-only",optionSource:"tenantDocumentTemplates"};function VZ(e){let n=[],t=[{slot:gq,production:"resolver",de:{a:"einen",the:"der",it:"ihn"}},{slot:yq,production:"template",de:{a:"eine",the:"die",it:"sie"}}];for(let{slot:r,production:i,de:o}of t){let a=e.inputs?.[r.id];if(a===void 0||a.kind==="unset")continue;let l=`inputs.${r.id}`;if(e.production!==i){n.push(Se(e,l,{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', nennt aber ${o.a} ${r.label.de} \u2014 nur production '${i}' verwendet sie.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but names a ${r.label.en.toLowerCase()} \u2014 only production '${i}' uses it.`}));continue}if(a.kind==="binding"){n.push(Se(e,l,{de:`[governedDocument/referenceNotLiteral] Knoten "${e.id}": ${o.the} ${r.label.de} ist ein fester Wert des Knotens, keine Bindung \u2014 w\xE4hlen Sie ${o.it} aus.`,en:`[governedDocument/referenceNotLiteral] Node "${e.id}": the ${r.label.en.toLowerCase()} is a fixed value of the node, not a binding \u2014 choose it from the list.`}));continue}if(a.kind!=="literal")continue;let d=Xl(a.value,{type:r.type});d!==null&&n.push(Se(e,l,{de:`[governedDocument/referenceShape] Knoten "${e.id}": ${d}.`,en:`[governedDocument/referenceShape] Node "${e.id}": ${d}.`}))}return n}s(VZ,"referenceInputIssues");var BZ={id:Si,type:"number",label:{de:"Antwortfrist (Tage)",en:"Answer within (days)"},inspector:"literal-only"},UZ={id:Ca,type:"boolean",label:{de:"Anschreiben best\xE4tigen lassen",en:"Have the cover letter confirmed"},inspector:"literal-only"},GZ={id:Bt,type:"legalEntity",label:uD,required:!0,inspector:"literal-only",optionSource:"tenantTraeger"};function zZ(e,n){let t=`inputs.${Bt}`,r=e.inputs?.[Bt];if(r!==void 0&&r.kind==="binding")return[Se(e,t,{de:`[governedDocument/traegerNotLiteral] Knoten "${e.id}": der Tr\xE4ger ist ein fester Wert des Knotens, keine Bindung \u2014 w\xE4hlen Sie ihn aus.`,en:`[governedDocument/traegerNotLiteral] Node "${e.id}": the legal entity is a fixed value of the node, not a binding \u2014 choose it from the list.`})];let i=Na(e),o=n?.resolverPrintsTraegerAddress?.get(e.id)??new Set,a=[];for(let l of new Set([...i===null?[]:[i],...o])){let d=n?.traeger?.get(l);n?.traeger!==void 0&&d===void 0?a.push(Se(e,t,{de:`[governedDocument/unknownTraeger] Knoten "${e.id}" nennt den Tr\xE4ger "${l}", den es in diesem Mandanten nicht gibt \u2014 bekannt: ${[...n.traeger.keys()].join(", ")||"(keiner)"}.`,en:`[governedDocument/unknownTraeger] Node "${e.id}" names the legal entity "${l}", which does not exist in this school \u2014 known: ${[...n.traeger.keys()].join(", ")||"(none)"}.`})):d!==void 0&&!d.hasAddress&&o.has(l)&&a.push(Se(e,t,{de:`[governedDocument/traegerAddressMissing] Die Vorlage des Generators an Knoten "${e.id}" druckt die Anschrift des Tr\xE4gers (${km.address}), aber "${l}" hat keine \u2014 in der Konfiguration des Mandanten nachtragen (foundation.legalEntities[].address).`,en:`[governedDocument/traegerAddressMissing] The generator template on node "${e.id}" prints the legal entity's address (${km.address}), but "${l}" has none \u2014 add it in the school's configuration (foundation.legalEntities[].address).`}))}return a}s(zZ,"traegerIssues");function Fh(e){if(e.production==="template"){let t=e.templateStamp?.fields;return Array.isArray(t)?t:[]}if(e.production!=="resolver")return[];let n=e.generatorStamp?.inputSchema?.fields;return Array.isArray(n)?n.map(t=>{let{label:r}=t;return r===void 0?{...t,label:{de:t.key,en:t.key}}:(zi(r)||F(`governedDocument "${e.id}": the stamped generator parameter "${t.key}" has no { de, en } label (${JSON.stringify(r)}) \u2014 rebuild local fixtures or obtain a reviewed repair of this retained workflow stamp.`),{...t,label:r})}):[]}s(Fh,"generatorFields");function WZ(e,n){return e.inputs?.[n]?.kind==="cockpit"}s(WZ,"deferredToCockpit");function YZ(e){return Xi(e.type)?e.type:void 0}s(YZ,"resolverSlotType");function HZ(e){if(e.confirmBeforeIssue!==!0||e.approval!=="none")return null;let n=La(e);return{confirm:{title:{de:`\u201E${n.de}\u201C jetzt senden?`,en:`Send "${n.en}" now?`},body:{de:"Das Dokument wird danach f\xFCr die Familie sichtbar.",en:"The family will be able to see the document afterwards."},confirmLabel:{de:"Senden",en:"Send"}}}}s(HZ,"issueConfirmation");function Se(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(Se,"issue");function Lh(e){return Em.includes(e.production)&&ss.includes(e.approval)&&Rm.includes(e.responseStrategy)}s(Lh,"hasValidModes");async function oS(e,n){let t=await va(e,{applicationId:n.applicationId,nodeId:n.node.id});if(t.length===0)return"pending";let r=t.filter(a=>a.isOpen&&a.kind==="admission");if(cq(r))return"producingHeld";if(r.some(a=>a.templateKey!==void 0&&bd.has(a.templateKey)))return"producing";if(r.some(a=>a.templateKey===co))return"awaitingCoverLetter";let i=r.find(a=>a.templateKey===Ir);if(i!==void 0)return i.status==="blocked"?"deferred":"awaitingApproval";if(r.some(a=>a.templateKey===ft))return"signatureStalled";let o=r.find(a=>a.templateKey===ns);if(o!==void 0){if(Ei(n.node).issuesBy==="provider"){let l=Dh(n.node)==="group"?(await rS(e,n.applicationId,n.node.id)).map(d=>d.contractId):[await Nh(n.node).contractOrNull(e,n.applicationId)].flatMap(d=>d===null?[]:[d]);if(l.length===0&&F(`governedDocCurrentState: eSignature node "${n.node.id}" has an open ask but no contract`),await rq(e,l)==="provider")return"awaitingSignature"}return Ei(n.node).producesResponseArtifact?await uq(e,{chain:lq(n.node),applicationId:n.applicationId,ask:o,onUnpinned:"notReturned",where:`governedDocCurrentState(node "${n.node.id}")`})===null?"awaitingResponse":"responseReturned":"awaitingResponse"}return r.some(a=>a.templateKey===ri)?"responseInCheck":"done"}s(oS,"governedDocCurrentState");function fq(e){return e.production!=="none"&&Dh(e)!=="artifact"}s(fq,"keepsDocumentInContractDomain");function JZ(e,n){let t=e.inputs?.[n.key];if(t?.kind!=="binding")return[];let r=t.address;if(!we(r)||r.scope!=="env"||!tr(r.key))return[];let i=Fo(r.key);if(n.type!==i.type)return[Se(e,`inputs.${n.key}`,{de:`[governedDocument/envNotCovered] Feld "${n.key}" ist ${n.type}, die Umgebungsvariable \u201E${i.label.de}\u201C (${de(r)}) liefert ${i.type}.`,en:`[governedDocument/envNotCovered] Field "${n.key}" is ${n.type}, the environment variable "${i.label.en}" (${de(r)}) supplies ${i.type}.`})];let o=new Set((n.options??[]).map(l=>l.value)),a=(i.enumOptions??[]).filter(l=>!o.has(l.value));return a.length===0?[]:[Se(e,`inputs.${n.key}`,{de:`[governedDocument/envNotCovered] Feld "${n.key}" kennt ${a.map(l=>`\u201E${l.label.de}\u201C (${l.value})`).join(", ")} nicht \u2014 die Umgebungsvariable \u201E${i.label.de}\u201C kann diese Werte liefern. Jeder Wert braucht eine Option.`,en:`[governedDocument/envNotCovered] Field "${n.key}" does not know ${a.map(l=>`"${l.label.en}" (${l.value})`).join(", ")} \u2014 the environment variable "${i.label.en}" can supply these values. Every value needs an option.`})]}s(JZ,"envCoverageIssues");function wq(e,n){let t=[];for(let r of Fh(e)){if(r.type==="party"||r.type==="personList")continue;if(t.push(...JZ(e,r)),r.processSource!==void 0){let a=e.inputs?.[r.key],l=a?.kind==="binding"?{de:`eine Bindung an ${we(a.address)?de(a.address):JSON.stringify(a.address)}`,en:`a binding to ${we(a.address)?de(a.address):JSON.stringify(a.address)}`}:a?.kind==="literal"?{de:"ein fester Wert",en:"a fixed value"}:WZ(e,r.key)?{de:"eine Erg\xE4nzung im Cockpit",en:"a completion in the cockpit"}:null;l!==null&&t.push({layer:"GRAPH",kind:"contractGap",path:`nodes.${e.id}.inputs.${r.key}`,reason:{de:`[governedDocument/processSourceConflict] "${r.label.de}" wird vom Vorgang selbst gef\xFCllt (${r.processSource}), daneben steht ${l.de}. Eine der beiden Quellen bliebe wirkungslos \u2014 entferne die Verdrahtung.`,en:`[governedDocument/processSourceConflict] "${r.label.en}" is filled by the case itself (${r.processSource}), and ${l.en} is set as well. One of the two sources would have no effect \u2014 remove the wiring.`},severity:"error"});continue}if(r.required!==!0)continue;let i=e.inputs?.[r.key];i?.kind==="binding"||i?.kind==="literal"||i?.kind==="cockpit"||r.defaultValue!==void 0||t.push({layer:"GRAPH",kind:"contractGap",path:`nodes.${e.id}.inputs.${r.key}`,reason:{de:`[governedDocument/unsourcedRequiredField] Pflichtfeld "${r.label.de}" des Generators ${n.de} hat keine Quelle \u2014 binde es an ein Formular-Export-Feld, setze einen festen Wert oder lass es ausdr\xFCcklich im Cockpit erg\xE4nzen.`,en:`[governedDocument/unsourcedRequiredField] Required field "${r.label.en}" of the generator ${n.en} has no source \u2014 bind it to a form export field, set a fixed value or leave it explicitly to the cockpit.`},severity:"error"})}return t}s(wq,"fieldSourceIssues");function QZ(e){let n=Er(e)??"\u2014";if(e.templateStamp===void 0)return[];let t=qM(e.templateStamp,n).map(({path:r,reason:i})=>Se(e,r===""?"templateStamp":`templateStamp.${r}`,i));return t.push(...wq(e,{de:`Vorlage "${n}"`,en:`template "${n}"`})),t}s(QZ,"templateIssues");function ZZ(e,n){return(n?.resolverDocumentAnchors?.get(e.id)??[]).flatMap(t=>{if(t.documentAnchors===null)return[Se(e,"resolver",{de:`[governedDocument/eSignatureAnchorMissing] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, aber die Vorlage des Generators "${t.pin}" wurde nie auf Unterschriftsanker gelesen \u2014 Vorlage neu hochladen und den Generator neu versiegeln.`,en:`[governedDocument/eSignatureAnchorMissing] Node "${e.id}" is signed electronically, but the generator template "${t.pin}" was never read for signature anchors \u2014 upload the template again and seal the generator again.`})];let r=t.signerAnchors.filter(i=>!t.documentAnchors.has(i));return r.length===0?[]:[Se(e,"resolver",{de:`[governedDocument/eSignatureAnchorMissing] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, aber die Vorlage von "${t.pin}" tr\xE4gt keinen Anker f\xFCr ${r.map(i=>`/unterschrift:${i}/`).join(", ")} \u2014 der Anbieter f\xE4nde f\xFCr diese Personen kein Unterschriftsfeld.`,en:`[governedDocument/eSignatureAnchorMissing] Node "${e.id}" is signed electronically, but the template of "${t.pin}" has no anchor for ${r.map(i=>`/unterschrift:${i}/`).join(", ")} \u2014 the provider would find no signature field for these people.`})]})}s(ZZ,"eSignatureAnchorIssues");function XZ(e,n){return n===void 0||n.sendable?[]:Ei(e).issuesBy!=="provider"?[]:[Se(e,"responseStrategy",{de:`[signing/noActiveProvider] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, aber die Schule kann nicht senden: ${n.reason.de}`,en:`[signing/noActiveProvider] Node "${e.id}" is signed electronically, but the school cannot send: ${n.reason.en}`})]}s(XZ,"eSignatureProviderIssues");var pq={key:"dokument",label:te("Dokument","Document"),scope:"node"},mq={producing:{label:te("Dokument in Vorbereitung","Document in preparation"),tone:"blue",phase:pq,external:nn(te("In Vorbereitung","In preparation"),"blue",te("Ihr Dokument wird vorbereitet","Your document is being prepared"),te("Die Schule erstellt Ihr Dokument. Sie erhalten es in K\xFCrze im Portal.","The school is preparing your document. You will receive it in the portal shortly."))},issued:{label:te("Dokument bereitgestellt","Document issued"),tone:"blue",phase:pq,external:nn(te("Dokument bereit","Document ready"),"amber",te("Ihr Dokument liegt bereit","Your document is ready"),te("Bitte beantworten Sie das Dokument innerhalb der Frist. Sie finden es in Ihren Aufgaben.","Please respond to the document within the deadline. You will find it in your tasks."),te("Dokument beantworten","Respond to the document"))}};function hq(e,n){return!Lh(e)||e.production==="none"?null:n===co||Im(e).some(r=>r.key===n)?Om(e):null}s(hq,"governedDocRowSlot");var kq={role:"user-action",effect:"side-effect",processHoldTemplate:s(()=>es,"processHoldTemplate"),progressDefaults:mq,progressEvents:Gn(mq),notificationEvents:s(e=>[{id:"issued",label:{de:"Dokument bereitgestellt",en:"Document issued"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0},{key:"dueInDays",type:"number"}]},{id:"responded",label:{de:"Antwort eingegangen",en:"Response received"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0}]},{id:"coverLetterAsked",label:{de:"Anschreiben zur Best\xE4tigung",en:"Cover letter to confirm"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0},{key:"dueInDays",type:"number",required:!1}]},{id:"responseRejected",label:{de:"R\xFCcklauf zur\xFCckgegeben",en:"Returned copy handed back"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0},{key:"reason",type:"string",required:!0}]}],"notificationEvents"),strictActionCoverage:!0,actions:s(e=>{if(!Lh(e))return[];let n=Ei(e),t=[],r=n.producesResponseArtifact?["awaitingResponse","responseReturned"]:["awaitingResponse"],i=n.issuesBy==="provider"?["awaitingSignature","signatureStalled",...r]:r,o=[...os(e)?["awaitingCoverLetter"]:[],...i,...n.checksReturn?["responseInCheck"]:[]];return e.production!=="none"&&(t.push({id:tb(e),kind:"internal",surface:Da,label:e.approval==="release"?{de:"Freigabe anfordern",en:"Request approval"}:{de:"Bereitstellen",en:"Issue document"},availableIn:["producing","producingHeld"],...e.approval==="release"?{handsTo:Ir}:{},...HZ(e)??{}}),t.push({id:hD,kind:"internal",surface:Da,label:{de:"Korrigieren",en:"Correct"},availableIn:o,superUserOnly:!0},{id:gD,kind:"internal",surface:Da,label:{de:"Zur\xFCckziehen & neu ausstellen",en:"Rescind & re-issue"},availableIn:o,superUserOnly:!0})),t.push(n.checksReturn?{id:xm,kind:"internal",label:e.responseLabels?.accept??n.defaultLabels.accept,availableIn:[r[r.length-1]],external:{emphasis:"primary",event:"documentReturned"}}:{id:n.acceptOutcomeId,kind:"advance",outcome:n.acceptOutcomeId,semantic:n.outcomeSemantics.accept,label:e.responseLabels?.accept??n.defaultLabels.accept,availableIn:[r[r.length-1]],external:{emphasis:"primary",event:"userTaskResolved"}},{id:n.declineOutcomeId,kind:"advance",outcome:n.declineOutcomeId,semantic:n.outcomeSemantics.decline,label:e.responseLabels?.decline??n.defaultLabels.decline,availableIn:os(e)?["awaitingCoverLetter",...i]:i,external:{emphasis:"decline",event:"userTaskResolved"}}),os(e)&&(t.push({id:bm,kind:"internal",label:{de:"Angebot best\xE4tigen",en:"Confirm offer"},availableIn:["awaitingCoverLetter"],external:{emphasis:"primary",event:"coverLetterConfirmed"}}),t.push({id:vm,kind:"internal",label:{de:"\xC4nderung anfordern",en:"Request a change"},availableIn:["awaitingCoverLetter"],external:{emphasis:"secondary",event:"coverLetterRevisionRequested"}})),n.producesResponseArtifact&&t.push({id:Sm,kind:"internal",label:{de:"\xC4nderung anfordern",en:"Request a change"},availableIn:i,external:{emphasis:"secondary",event:"documentChangeRequested"}}),n.issuesBy==="provider"&&t.push({id:Am,kind:"internal",surface:Da,label:{de:"Erneut senden",en:"Send again"},availableIn:["signatureStalled"]},{id:ts,kind:"internal",surface:Da,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}),t},"actions"),states:yD,currentState:oS,workItemTemplates:s(e=>{let n=e;return Lh(n)?Im(n):[]},"workItemTemplates"),taskDocuments:s((e,n)=>{let t=e,r=hq(t,n);return r===null?[]:Im(t).find(o=>o.key===n)?.recipient==="internal"?[{kind:"artifact",key:r}]:[]},"taskDocuments"),taskView:s((e,n)=>{let t=hq(e,n);if(t!==null)return n===co?{kind:"artifact",slot:t,part:"coverLetter"}:{kind:"artifact",slot:t}},"taskView"),inputs:s(e=>[...e.production==="resolver"?[gq,GZ]:[],...e.production==="template"?[yq]:[],BZ,...e.generatorStamp?.coverLetter===!0?[UZ]:[],...Fh(e).filter(n=>n.type!=="party"&&n.type!=="personList").flatMap(n=>{let t=YZ(n);return t===void 0?[]:[{field:n,type:t}]}).map(({field:n,type:t})=>({id:n.key,type:t,label:n.label,required:n.required===!0&&n.processSource===void 0,...n.processSource===void 0?{deferrable:!0}:{},...n.defaultValue!==void 0&&(typeof n.defaultValue=="string"||typeof n.defaultValue=="number"||typeof n.defaultValue=="boolean"||n.defaultValue===null||t==="pricedItem"&&Zi(n.defaultValue))?{defaultValue:n.defaultValue}:{},...n.options!==void 0?{enumOptions:n.options}:{}}))],"inputs"),outputs:s(e=>e.production==="none"?[]:[{name:Vw,type:"documentRef",label:{de:"Dokument",en:"Document"}}],"outputs"),refuseBlocksTarget:s((e,n)=>{if(n===ns||n===co||n===kd||n===ri||n===ft){let t=n===ns?{de:"die Antwort-Aufgabe geh\xF6rt dem Empf\xE4nger",en:"the response task belongs to the recipient"}:n===ri?{de:"die Pr\xFCfung des R\xFCcklaufs entsteht erst mit dem R\xFCcklauf der Familie",en:"the check of the returned copy only arises once the family returns it"}:n===ft?{de:"die Kl\xE4rung der elektronischen Unterschrift entsteht erst, wenn sie nicht zustande kommt",en:"resolving the electronic signature only arises when it does not come about"}:{de:"die \xDCberarbeitungs-Aufgabe entsteht nur durch eine Ablehnung",en:"the revision task only arises from a rejection"};return{de:`[governedDocument/blocksTarget] 'blocks' auf "${n}" (Knoten "${e.id}") ist verboten \u2014 ${t.de}; zul\xE4ssige intrinsische Ziele: ${es}${e.approval==="release"?`, ${Ir}`:""}.`,en:`[governedDocument/blocksTarget] 'blocks' on "${n}" (node "${e.id}") is not allowed \u2014 ${t.en}; allowed intrinsic targets: ${es}${e.approval==="release"?`, ${Ir}`:""}.`}}return n===Ir&&e.approval==="none"?{de:`[governedDocument/blocksTarget] 'blocks' auf "${Ir}" auf Knoten "${e.id}" \u2014 mit approval 'none' existiert dieses Template nicht; der Blocker w\xFCrde ein Phantom aufschieben.`,en:`[governedDocument/blocksTarget] 'blocks' on "${Ir}" on node "${e.id}" \u2014 with approval 'none' this template does not exist; the blocker would postpone a phantom.`}:null},"refuseBlocksTarget"),userUploadGate:s(async(e,n)=>{if(fq(n.node))return!1;let t=await oS(e,n),r=(t==="awaitingResponse"||t==="responseReturned")&&Ei(n.node).producesResponseArtifact;return n.actor==="recipient"?r:t==="producing"&&n.node.production==="upload"||r},"userUploadGate"),userUploadConfirmation:s(async(e,n)=>{let t=dq(n.node);if(t===null||fq(n.node))return null;let r=await oS(e,n);return r==="awaitingResponse"||r==="responseReturned"?t:null},"userUploadConfirmation"),validate:s((e,n,t)=>{let r=[];if(!Lh(e))return r.push(Se(e,"modes",{de:`[governedDocument/unknownMode] Knoten "${e.id}" deklariert keine g\xFCltige Betriebsart \u2014 erforderlich: production \u2208 {${Em.join(", ")}} (ist: ${JSON.stringify(e.production)}), approval \u2208 {${ss.join(", ")}} (ist: ${JSON.stringify(e.approval)}), responseStrategy \u2208 {${Rm.join(", ")}} (ist: ${JSON.stringify(e.responseStrategy)}). Eine Betriebsart ist eine erkl\xE4rte Entscheidung, nie aus der Verdrahtung abgeleitet.`,en:`[governedDocument/unknownMode] Node "${e.id}" declares no valid mode \u2014 required: production \u2208 {${Em.join(", ")}} (is: ${JSON.stringify(e.production)}), approval \u2208 {${ss.join(", ")}} (is: ${JSON.stringify(e.approval)}), responseStrategy \u2208 {${Rm.join(", ")}} (is: ${JSON.stringify(e.responseStrategy)}). A mode is a declared decision, never derived from the wiring.`})),r;let i=Ai[e.responseStrategy];e.production==="none"&&(e.approval!=="none"||e.responseStrategy!=="confirm")&&r.push(Se(e,"production",{de:`[governedDocument/modeContract] Knoten "${e.id}" hat production 'none' \u2014 ohne Dokument gibt es nichts freizugeben und nichts zu unterschreiben: approval muss 'none' sein (ist: '${e.approval}') und responseStrategy 'confirm' (ist: '${e.responseStrategy}').`,en:`[governedDocument/modeContract] Node "${e.id}" has production 'none' \u2014 with no document there is nothing to release and nothing to sign: approval must be 'none' (is: '${e.approval}') and responseStrategy 'confirm' (is: '${e.responseStrategy}').`}));let o=e.artifacts??[];if(e.production==="none")o.length!==0&&r.push(Se(e,"artifacts",{de:`[governedDocument/slotContract] Knoten "${e.id}" hat production 'none', deklariert aber ${o.length} Artefakt-Slot(s) \u2014 ein dokumentloser Best\xE4tigungs-Knoten verwaltet keinen Slot.`,en:`[governedDocument/slotContract] Node "${e.id}" has production 'none' but declares ${o.length} artifact slot(s) \u2014 a confirmation node without a document manages no slot.`}));else{o.length!==1&&r.push(Se(e,"artifacts",{de:`[governedDocument/slotContract] Knoten "${e.id}" deklariert ${o.length} Artefakt-Slots \u2014 genau EINER (das verwaltete Dokument) ist erforderlich.`,en:`[governedDocument/slotContract] Node "${e.id}" declares ${o.length} artifact slots \u2014 exactly ONE (the managed document) is required.`}));for(let T of o)T.visibility!=="external"&&r.push(Se(e,"artifacts",{de:`[governedDocument/slotContract] Slot "${T.key}" auf Knoten "${e.id}" hat visibility "${T.visibility}" \u2014 das verwaltete Dokument MUSS 'external' sein, sonst kann die bewerbende Person es auf /e nie sehen.`,en:`[governedDocument/slotContract] Slot "${T.key}" on node "${e.id}" has visibility "${T.visibility}" \u2014 the managed document MUST be 'external', otherwise the applicant can never see it on /e.`}))}let a=e.outcomes??[],l=a.map(T=>T.id),d=[i.acceptOutcomeId,i.declineOutcomeId];(a.length!==2||!d.every(T=>l.includes(T)))&&r.push(Se(e,"outcomes",{de:`[governedDocument/outcomeContract] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') muss genau ZWEI Outcomes deklarieren \u2014 das Accept-Terminal "${i.acceptOutcomeId}" und das Decline-Terminal "${i.declineOutcomeId}" (deklariert: ${l.length>0?l.map(T=>`"${T}"`).join(", "):"keine"}). Beide sind Pflicht: der Knoten besitzt die Antwort, nicht nur die Freigabe.`,en:`[governedDocument/outcomeContract] Node "${e.id}" (responseStrategy '${e.responseStrategy}') must declare exactly TWO outcomes \u2014 the accept terminal "${i.acceptOutcomeId}" and the decline terminal "${i.declineOutcomeId}" (declared: ${l.length>0?l.map(T=>`"${T}"`).join(", "):"none"}). Both are required: the node owns the answer, not only the release.`}));let c=e.titles,u=s(T=>{let E=c?.[T];return E===null||typeof E!="object"||!Object.values(E??{}).some($=>typeof $=="string"&&$.length>0)},"missingTitle"),p=[];e.production!=="none"&&p.push("prepare","revise"),e.approval==="release"&&p.push("approve"),i.checksReturn&&p.push("check");let h=p.filter(u);h.length>0&&r.push(Se(e,"titles",{de:`[governedDocument/missingTitles] Knoten "${e.id}" fehlen die Aufgaben-Titel ${h.join(", ")} \u2014 der Knotentyp ist dokument-agnostisch, die Betitelung ist Pflicht-Konfiguration seiner Betriebsart.`,en:`[governedDocument/missingTitles] Node "${e.id}" is missing the task titles ${h.join(", ")} \u2014 the node type is document-agnostic, titling is required configuration of its mode.`}));let y=e.assign??{};if(e.production!=="none"&&y.prepareDocument===void 0&&r.push(Se(e,"assign.prepareDocument",{de:`[governedDocument/productionAssign] Knoten "${e.id}" (production '${e.production}') verdrahtet kein Produzenten-Team (assign.prepareDocument) \u2014 ohne Producer-Aufgabe g\xE4be es die Submit-Aktion ohne freischaltendes Work-Item.`,en:`[governedDocument/productionAssign] Node "${e.id}" (production '${e.production}') wires no producer team (assign.prepareDocument) \u2014 without a producer task there would be the submit action without an enabling work item.`})),e.approval==="none"&&(y.releaseApproval!==void 0&&r.push(Se(e,"assign.releaseApproval",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat approval 'none', verdrahtet aber assign.releaseApproval \u2014 tote Verdrahtung darf nicht als konfiguriert durchgehen (Betriebsart explizit \xE4ndern statt Gruppen zuweisen).`,en:`[governedDocument/deadWiring] Node "${e.id}" has approval 'none' but wires assign.releaseApproval \u2014 dead wiring must not pass as configured (change the mode explicitly instead of assigning groups).`})),c?.approve!==void 0&&r.push(Se(e,"titles.approve",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat approval 'none', deklariert aber titles.approve \u2014 es gibt keine Freigabe-Aufgabe, die diesen Titel tr\xFCge.`,en:`[governedDocument/deadWiring] Node "${e.id}" has approval 'none' but declares titles.approve \u2014 there is no release task that would carry this title.`}))),i.checksReturn)y.responseCheck===void 0&&r.push(Se(e,"assign.responseCheck",{de:`[governedDocument/checkAssign] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') verdrahtet kein Team f\xFCr die Pr\xFCfung des R\xFCcklaufs (assign.responseCheck) \u2014 ohne Team l\xE4ge jeder R\xFCcklauf bei niemandem.`,en:`[governedDocument/checkAssign] Node "${e.id}" (responseStrategy '${e.responseStrategy}') wires no team for checking the returned copy (assign.responseCheck) \u2014 without a team every returned copy would lie with nobody.`})),e.production!=="resolver"&&i.issuesBy==="provider"?r.push(Se(e,"responseStrategy",{de:`[governedDocument/eSignatureNeedsResolver] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben (eSignature), erzeugt das Dokument aber mit production '${e.production}' \u2014 der Anbieter bekommt eine eingefrorene Vertragsrevision mit Unterschriftsankern und deklarierten Unterzeichnern, und die entsteht nur mit production 'resolver'.`,en:`[governedDocument/eSignatureNeedsResolver] Node "${e.id}" is signed electronically (eSignature) but produces the document with production '${e.production}' \u2014 the provider gets a frozen contract revision with signature anchors and declared signatories, and that only exists with production 'resolver'.`})):e.production!=="resolver"&&r.push(Se(e,"responseStrategy",{de:`[governedDocument/checkNeedsContract] Knoten "${e.id}" pr\xFCft den R\xFCcklauf (signedUploadChecked), erzeugt das Dokument aber mit production '${e.production}' \u2014 die Pr\xFCfung hakt die unterzeichnenden Personen einer eingefrorenen Vertragsrevision ab, und die entsteht nur mit production 'resolver'.`,en:`[governedDocument/checkNeedsContract] Node "${e.id}" checks the returned copy (signedUploadChecked) but produces the document with production '${e.production}' \u2014 the check ticks off the signatories of a frozen contract revision, and that only exists with production 'resolver'.`}));else{e.production==="resolver"&&r.push(Se(e,"responseStrategy",{de:`[governedDocument/contractNeedsCheckedReturn] Knoten "${e.id}" erzeugt einen Vertrag (production 'resolver'), beantwortet ihn aber mit '${e.responseStrategy}' \u2014 ein Vertrag gilt erst als unterschrieben, wenn die Schule den R\xFCcklauf gepr\xFCft hat oder ein Anbieter die Unterschrift belegt: responseStrategy muss 'signedUploadChecked' oder 'eSignature' sein (mit assign.responseCheck und titles.check).`,en:`[governedDocument/contractNeedsCheckedReturn] Node "${e.id}" produces a contract (production 'resolver') but answers it with '${e.responseStrategy}' \u2014 a contract only counts as signed once the school has checked the returned copy or a provider proves the signature: responseStrategy must be 'signedUploadChecked' or 'eSignature' (with assign.responseCheck and titles.check).`}));for(let[T,E]of[["assign.responseCheck",y.responseCheck!==void 0],["titles.check",c?.check!==void 0]])E&&r.push(Se(e,T,{de:`[governedDocument/deadWiring] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') deklariert ${T} \u2014 eine Pr\xFCfung des R\xFCcklaufs gibt es nur mit responseStrategy 'signedUploadChecked' oder 'eSignature'.`,en:`[governedDocument/deadWiring] Node "${e.id}" (responseStrategy '${e.responseStrategy}') declares ${T} \u2014 a check of the returned copy only exists with responseStrategy 'signedUploadChecked' or 'eSignature'.`}))}if(i.issuesBy==="provider"?y.signingRecovery===void 0&&r.push(Se(e,"assign.signingRecovery",{de:`[governedDocument/recoveryAssign] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, verdrahtet aber kein Team f\xFCr die Kl\xE4rung einer Unterschrift, die nicht zustande kommt (assign.signingRecovery) \u2014 \u201EErneut senden" und \u201EAuf Papier umstellen" l\xE4gen bei niemandem.`,en:`[governedDocument/recoveryAssign] Node "${e.id}" is signed electronically but wires no team for resolving a signature that does not come about (assign.signingRecovery) \u2014 "Send again" and "Switch to paper" would lie with nobody.`})):y.signingRecovery!==void 0&&r.push(Se(e,"assign.signingRecovery",{de:`[governedDocument/deadWiring] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') deklariert assign.signingRecovery \u2014 eine Kl\xE4rung der elektronischen Unterschrift gibt es nur mit responseStrategy 'eSignature'.`,en:`[governedDocument/deadWiring] Node "${e.id}" (responseStrategy '${e.responseStrategy}') declares assign.signingRecovery \u2014 resolving an electronic signature only exists with responseStrategy 'eSignature'.`})),i.issuesBy==="provider"&&r.push(...ZZ(e,t),...XZ(e,t?.signingProvider)),e.confirmBeforeIssue!==void 0&&typeof e.confirmBeforeIssue!="boolean"?r.push(Se(e,"confirmBeforeIssue",{de:`[governedDocument/confirmBeforeIssue] Knoten "${e.id}" setzt confirmBeforeIssue auf ${JSON.stringify(e.confirmBeforeIssue)} \u2014 erlaubt ist nur true oder false.`,en:`[governedDocument/confirmBeforeIssue] Node "${e.id}" sets confirmBeforeIssue to ${JSON.stringify(e.confirmBeforeIssue)} \u2014 only true or false is allowed.`})):e.confirmBeforeIssue===!0&&e.approval==="release"&&r.push(Se(e,"confirmBeforeIssue",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat approval 'release', deklariert aber confirmBeforeIssue \u2014 \u201EFreigabe anfordern" schickt noch nichts an die Familie, und die Freigabe selbst ist die bewusste Pr\xFCfung vor dem Versand. Die R\xFCckfrage gibt es nur mit approval 'none'.`,en:`[governedDocument/deadWiring] Node "${e.id}" has approval 'release' but declares confirmBeforeIssue \u2014 "Request release" sends nothing to the family yet, and the release itself is the deliberate check before sending. The confirmation prompt only exists with approval 'none'.`})),e.confirmContractTerms!==void 0&&typeof e.confirmContractTerms!="boolean"&&r.push(Se(e,"confirmContractTerms",{de:`[governedDocument/confirmContractTerms] Knoten "${e.id}" setzt confirmContractTerms auf ${JSON.stringify(e.confirmContractTerms)} \u2014 erlaubt ist nur true oder false.`,en:`[governedDocument/confirmContractTerms] Node "${e.id}" sets confirmContractTerms to ${JSON.stringify(e.confirmContractTerms)} \u2014 only true or false is allowed.`})),yc(e))e.confirmContractTerms===!1&&e.contractTermsQuestionText!==void 0&&r.push(Se(e,"contractTermsQuestionText",{de:`[governedDocument/deadWiring] Knoten "${e.id}" schaltet die Best\xE4tigung der Vertragsbedingungen ab (confirmContractTerms: false), formuliert aber die Frage um \u2014 ohne Best\xE4tigung wird sie nie gestellt.`,en:`[governedDocument/deadWiring] Node "${e.id}" switches off the confirmation of the contract terms (confirmContractTerms: false) but rewords the question \u2014 without the confirmation it is never asked.`}));else for(let[T,E]of[["confirmContractTerms",e.confirmContractTerms!==void 0],["contractTermsQuestionText",e.contractTermsQuestionText!==void 0]])E&&r.push(Se(e,T,{de:`[governedDocument/deadWiring] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') deklariert ${T} \u2014 die Best\xE4tigung der Vertragsbedingungen geh\xF6rt zum Hochladen der unterschriebenen Fassung, das es nur mit responseStrategy 'signedUpload' oder 'signedUploadChecked' gibt.`,en:`[governedDocument/deadWiring] Node "${e.id}" (responseStrategy '${e.responseStrategy}') declares ${T} \u2014 the confirmation of the contract terms belongs to uploading the signed copy, which only exists with responseStrategy 'signedUpload' or 'signedUploadChecked'.`}));if(e.production==="none")for(let[T,E]of[["confirmBeforeIssue",e.confirmBeforeIssue===!0],["assign.prepareDocument",y.prepareDocument!==void 0],["titles.prepare",c?.prepare!==void 0],["titles.revise",c?.revise!==void 0]])E&&r.push(Se(e,T,{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production 'none', deklariert aber ${T} \u2014 ohne Produktionsphase gibt es keinen Tr\xE4ger daf\xFCr.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production 'none' but declares ${T} \u2014 without a production phase there is nothing to carry it.`}));for(let T of e.tasks??[])iS.has(T.key)&&r.push(Se(e,`tasks.${T.key}`,{de:`[governedDocument/keyShadowsIntrinsic] Task-Key "${T.key}" auf Knoten "${e.id}" kollidiert mit einem intrinsischen Template (${[...iS].join(", ")}) \u2014 anderen Key w\xE4hlen.`,en:`[governedDocument/keyShadowsIntrinsic] Task key "${T.key}" on node "${e.id}" collides with an intrinsic template (${[...iS].join(", ")}) \u2014 choose another key.`}));if(e.production==="resolver"?r.push(...zZ(e,t)):e.inputs?.[Bt]!==void 0&&r.push(Se(e,`inputs.${Bt}`,{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', nennt aber einen Tr\xE4ger \u2014 nur ein erzeugter Vertrag hat eine Vertragspartei der Schule.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but names a legal entity \u2014 only a generated contract has a contracting party on the school's side.`})),r.push(...VZ(e)),e.production==="resolver"){let T=mi(e);if(T!==null){let E=JO(T);for(let $ of Fh(e)){if(!Xi($.type)){r.push(Se(e,`generatorStamp.inputSchema.${$.key}`,{de:`[governedDocument/unknownFieldType] Generator "${E}" typisiert das Feld "${$.key}" als "${String($.type)}" \u2014 das geh\xF6rt nicht zum Wert-Vokabular der Plattform (${sa.join(", ")}). Die gepinnte Revision stammt aus einer \xE4lteren Fassung und muss neu versiegelt werden.`,en:`[governedDocument/unknownFieldType] Generator "${E}" types the field "${$.key}" as "${String($.type)}" \u2014 that is not part of the platform's value vocabulary (${sa.join(", ")}). The pinned revision comes from an older version and must be sealed again.`}));continue}if($.type==="personList"){r.push(Se(e,`generatorStamp.inputSchema.${$.key}`,{de:`[governedDocument/partyListUnsupported] Generator "${E}" deklariert das Feld "${$.key}" als personList \u2014 daf\xFCr gibt es keine Platzhalter-Heimat im Dokument und keine Eingabe. Eine Liste von Personen geh\xF6rt als Rolle mit Kapazit\xE4t deklariert oder als berechneter Textwert.`,en:`[governedDocument/partyListUnsupported] Generator "${E}" declares the field "${$.key}" as personList \u2014 there is no placeholder home for it in the document and no input. A list of people belongs declared as a role with capacity or as a computed text value.`}));continue}$.type==="party"&&($.key.endsWith("PartyId")||r.push(Se(e,`generatorStamp.inputSchema.${$.key}`,{de:`[governedDocument/partyFieldKey] Party-Feld "${$.key}" endet nicht auf "PartyId" \u2014 aus diesem Suffix wird der Platzhalter-Pr\xE4fix im Dokument abgeleitet (emergencyContactPartyId \u2192 emergency_contact).`,en:`[governedDocument/partyFieldKey] Party field "${$.key}" does not end in "PartyId" \u2014 the placeholder prefix in the document is derived from this suffix (emergencyContactPartyId \u2192 emergency_contact).`})))}r.push(...wq(e,{de:`"${E}"`,en:`"${E}"`}))}}else e.generatorStamp!==void 0&&r.push(Se(e,"generatorStamp",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', tr\xE4gt aber den Stempel eines Generators \u2014 ohne maschinelle Produktion l\xE4uft keiner.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but carries a generator stamp \u2014 without machine production none runs.`}));e.production==="template"?r.push(...QZ(e)):e.templateStamp!==void 0&&r.push(Se(e,"templateStamp",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', tr\xE4gt aber die Parameter einer Vorlage \u2014 ohne Vorlagen-Produktion wird sie nie gef\xFCllt.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but carries a template's parameters \u2014 without template production it is never filled.`}));let k=e.inputs?.[Ca];k!==void 0&&k.kind!=="unset"&&!(k.kind==="literal"&&typeof k.value=="boolean")&&r.push(Se(e,`inputs.${Ca}`,{de:`[governedDocument/coverLetterInput] Knoten "${e.id}": Die Best\xE4tigung des Anschreibens ist ein fester Wert ja oder nein.`,en:`[governedDocument/coverLetterInput] Node "${e.id}": the cover letter's confirmation is a fixed yes or no.`})),os(e)&&(t!==void 0&&e.generatorStamp?.coverLetter!==!0&&r.push(Se(e,`inputs.${Ca}`,{de:`[governedDocument/coverLetterNotDeclared] Knoten "${e.id}" l\xE4sst ein Anschreiben best\xE4tigen, sein Generator erzeugt aber keines.`,en:`[governedDocument/coverLetterNotDeclared] Node "${e.id}" asks to confirm a cover letter, but its generator produces none.`})),e.approval!=="release"&&r.push(Se(e,"approval",{de:`[governedDocument/coverLetterNeedsRelease] Knoten "${e.id}": Ein Anschreiben mit Best\xE4tigung braucht die Freigabe, denn Vertrag und Anschreiben werden zusammen freigegeben.`,en:`[governedDocument/coverLetterNeedsRelease] Node "${e.id}": a cover letter with confirmation needs the release, because contract and letter are released together.`})),Ei(e).producesResponseArtifact||r.push(Se(e,"responseStrategy",{de:`[governedDocument/coverLetterNeedsSigning] Knoten "${e.id}": Ein Anschreiben steht vor einer Unterschrift; dieser Knoten l\xE4sst nicht unterschreiben.`,en:`[governedDocument/coverLetterNeedsSigning] Node "${e.id}": a cover letter comes before a signature; this node takes none.`})));let w=e.inputs?.[Si],b=w===void 0||w.kind==="unset"?void 0:w.kind==="literal"?w.value:w;return b!==void 0&&!xd(b)&&r.push(Se(e,`inputs.${Si}`,{de:`[governedDocument/dueInDays] Knoten "${e.id}" setzt responseDueInDays auf ${JSON.stringify(b)} \u2014 erlaubt ist eine ganze Zahl von ${rs} bis ${is} Tagen.`,en:`[governedDocument/dueInDays] Node "${e.id}" sets responseDueInDays to ${JSON.stringify(b)} \u2014 a whole number from ${rs} to ${is} days is allowed.`})),b===void 0&&Fh(e).some(T=>T.processSource==="responseDueInDays")&&r.push(Se(e,`inputs.${Si}`,{de:`[governedDocument/dueInDays] Knoten "${e.id}" druckt die Antwortfrist (processSource 'responseDueInDays'), setzt aber kein responseDueInDays \u2014 das Dokument nennte eine Frist, die es nicht gibt.`,en:`[governedDocument/dueInDays] Node "${e.id}" prints the response deadline (processSource 'responseDueInDays') but sets no responseDueInDays \u2014 the document would name a deadline that does not exist.`})),r},"validate")};var bq={addPupil:{method:"POST",path:"/api/v1/admissions/AddPrPupilBasic/{schoolid}",kind:"create",body:"PrPupilBasicCreate",required:["forename","surname","genderId"],maxLength:{titleId:4,forename:50,surname:50,middleName:50,preferredForename:50,preferredSurname:50,genderId:4,firstLanguage:4}},addAdmissionDetails:{method:"POST",path:"/api/v1/admissions/AddAdmissionDetails/{schoolid}/{pupilid}",kind:"create",body:"AddPrPupilAdmissionDetails",required:[],maxLength:{boarderStatusId:4,ageAdjust:4,entryYear:4,entryTerm:4,entryYearGroup:4,currentSchoolId:20,enquirySource:4,currentAdmissionStageId:25}},addNationality:{method:"POST",path:"/api/v1/admissions/AddNationlityInfo/{schoolid}/{pupilid}",kind:"create",body:"NationalityInfoCreate",required:["nationalityId"],maxLength:{nationalityId:4,countryOfBirth:4}},addVisa:{method:"POST",path:"/api/v1/admissions/AddVisaInfo/{schoolid}/{pupilid}",kind:"create",body:"CreateVisaInfo",required:[],maxLength:{placeOfBirth:50,passportCountry:4,passportNumber:50,residenceVisaNumber:50,healthCardNumber:50}},addMedical:{method:"POST",path:"/api/v1/admissions/AddMedicalInfo/{schoolid}/{pupilid}",kind:"create",body:"MedicalInfoCreate",required:[],maxLength:{}},addContact:{method:"POST",path:"/api/v1/admissions/AddContactBasicInfo/{schoolid}/{pupilid}",kind:"create",body:"AddContactBasicInfo",required:["titleId","firstName","lastName","genderId"],maxLength:{relationshipId:4,titleId:4,firstName:50,middleName:50,lastName:50,contactName:200,greeting:200,languageId:4,secondLanguageId:4,genderId:4,professionId:4,companyName:50,jobTitle:50}},linkExistingContact:{method:"POST",path:"/api/v1/admissions/LinkExistingContact/{schoolid}/{pupilid}/{contactid}",kind:"create",body:"LinkContact",required:["relationshipId"],maxLength:{relationshipId:4}},addContactAddress:{method:"POST",path:"/api/v1/admissions/AddContactAddressNew/{schoolid}/{contactid}/{addressformatid}",kind:"create",body:"AddAddressVM",required:["countryId"],maxLength:{addressTypeId:4,countryId:4,addressLine1:100,addressLine2:100,addressLine3:100,addressLine4:100,addressLine5:100,addressLine6:100,lookup1:4,lookup2:4,lookup3:4,lookup4:4,lookup5:4}},addContactEmail:{method:"POST",path:"/api/v1/admissions/AddContactEmail/{schoolid}/{contactid}",kind:"create",body:"AddEmailAddress",required:["emailTypeId","email"],maxLength:{emailTypeId:4,email:254}},addContactTelephone:{method:"POST",path:"/api/v1/admissions/AddContactTelephone/{schoolid}/{contactid}",kind:"create",body:"AddTelephoneNumber",required:["typeId","number"],maxLength:{typeId:4}},linkAddressToPupil:{method:"PUT",path:"/api/v1/admissions/LinkAddressToPupil/{schoolId}/{pupilId}/{addressId}",kind:"update",required:[],maxLength:{}},updatePupilAif:{method:"POST",path:"/api/v1/additionalinformation/UpdatePupilAIF/{schoolid}/{pupilid}",kind:"update",body:"AifFieldValueVM",required:[],maxLength:{}},updateContactAif:{method:"POST",path:"/api/v1/additionalinformation/UpdateContactAIF/{schoolid}/{contactid}",kind:"update",body:"AifFieldValueVM",required:[],maxLength:{}},listPupils:{method:"GET",path:"/api/v1/admissions/GetPrPupilBasicInfo/{schoolid}",kind:"read",required:[],maxLength:{}},getPupil:{method:"GET",path:"/api/v1/admissions/GetPrPupilBasicInfoById/{schoolid}/{pupilid}",kind:"read",required:[],maxLength:{}},listContactsOfPupil:{method:"GET",path:"/api/v1/admissions/GetContactBasicInfoByPupilId/{schoolid}/{pupilid}",kind:"read",required:[],maxLength:{}},getContact:{method:"GET",path:"/api/v1/admissions/GetContactByContactId/{schoolid}/{contactid}",kind:"read",required:[],maxLength:{}},readPupilAifFields:{method:"GET",path:"/api/v1/additionalinformation/ReadPupilAIFFields/{schoolid}",kind:"read",required:[],maxLength:{}},readContactAifFields:{method:"GET",path:"/api/v1/additionalinformation/ReadContactAIFFields/{schoolid}",kind:"read",required:[],maxLength:{}}};function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ht,"isRecord");var sS=["field","join","literal","address","payment","contract"],e9=new Set(["text","date","datetime","bool","aifBool","money","moneyText"]),n9=new Set(["street","streetAndNumber","hausnr","plz","ort","land","full"]);function fr(e){return typeof e=="string"&&e.trim().length>0}s(fr,"nonEmptyString");function Mh(e,n,t,r,i="value"){if(!Ht(e)||!Ht(e.from)){r.push({path:n,code:"mappingShape",message:{de:`${n}: eine Zuordnung braucht \`from\`.`,en:`${n}: a mapping needs \`from\`.`}});return}let o=e.from,a=sS.filter(c=>c in o);if(a.length!==1){r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from\` nennt genau eine Quelle (${sS.join(" | ")}).`,en:`${n}: \`from\` names exactly one source (${sS.join(" | ")}).`}});return}let[l]=a;l==="field"&&!fr(o.field)&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.field\` ist leer.`,en:`${n}: \`from.field\` is empty.`}}),l==="join"&&!(Array.isArray(o.join)&&o.join.length>=2&&o.join.every(fr))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.join\` nennt mindestens zwei Formularfelder.`,en:`${n}: \`from.join\` names at least two form fields.`}}),e.whenEmpty!==void 0&&(i==="condition"?r.push({path:n,code:"mappingShape",message:{de:`${n}: \`whenEmpty\` gilt nicht f\xFCr eine Bedingung (\`unless\`, \`linkAddressToPupilIf\`).`,en:`${n}: \`whenEmpty\` does not apply to a condition (\`unless\`, \`linkAddressToPupilIf\`).`}}):l!=="field"&&l!=="join"?r.push({path:n,code:"mappingShape",message:{de:`${n}: \`whenEmpty\` gilt nur f\xFCr eine Formularantwort (\`field\`, \`join\`).`,en:`${n}: \`whenEmpty\` applies only to a form answer (\`field\`, \`join\`).`}}):typeof e.whenEmpty=="boolean"||Number.isFinite(e.whenEmpty)||fr(e.whenEmpty)||r.push({path:n,code:"mappingShape",message:{de:`${n}: \`whenEmpty\` ist ein Engage-Wert (Text, Zahl oder ja/nein).`,en:`${n}: \`whenEmpty\` is an Engage value (text, number or yes/no).`}})),l==="address"&&!(we(o.address)&&o.address.scope==="env"&&tr(o.address.key))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.address\` ist eine Umgebungsvariable (\`{ scope: 'env', key: 'stage.key' }\`).`,en:`${n}: \`from.address\` is an environment value (\`{ scope: 'env', key: 'stage.key' }\`).`}}),l==="payment"&&o.payment!=="amount"&&o.payment!=="settledAt"&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.payment\` ist amount oder settledAt.`,en:`${n}: \`from.payment\` is amount or settledAt.`}}),l==="contract"&&!["startDate","signedAt","createdAt"].includes(String(o.contract))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.contract\` ist startDate, signedAt oder createdAt.`,en:`${n}: \`from.contract\` is startDate, signedAt or createdAt.`}}),l==="literal"&&!["string","number","boolean"].includes(typeof o.literal)&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.literal\` ist Text, Zahl oder ja/nein.`,en:`${n}: \`from.literal\` is text, a number or yes/no.`}}),e.format!==void 0&&!e9.has(String(e.format))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: unbekanntes Format \u201E${String(e.format)}".`,en:`${n}: unknown format "${String(e.format)}".`}}),e.lookup!==void 0&&!(fr(e.lookup)&&Ht(t[e.lookup]))&&r.push({path:n,code:"unknownLookup",message:{de:`${n}: die Lookup-Tabelle \u201E${String(e.lookup)}" fehlt in \`lookups\`.`,en:`${n}: the lookup table "${String(e.lookup)}" is missing from \`lookups\`.`}});let d=e.pick;d!==void 0&&(d==="firstWord"||d==="restWords"||d==="year"||Ht(d)&&Number.isInteger(d.index)&&Number(d.index)>=0||Ht(d)&&n9.has(String(d.address))||r.push({path:n,code:"mappingShape",message:{de:`${n}: unbekannte Auswahl \`pick\`.`,en:`${n}: unknown selection \`pick\`.`}}))}s(Mh,"checkMapping");function mo(e,n,t,r,i){if(!Ht(e)){i.push({path:n,code:"bodyShape",message:{de:`${n}: erwartet ein Objekt Feld \u2192 Zuordnung.`,en:`${n}: expects an object field \u2192 mapping.`}});return}let o=bq[t];for(let a of o.required)a in e||i.push({path:`${n}.${a}`,code:"missingRequired",message:{de:`${n}: Engage verlangt \u201E${a}" (${o.body}) \u2014 es fehlt eine Zuordnung.`,en:`${n}: Engage requires "${a}" (${o.body}) \u2014 a mapping is missing.`}});for(let[a,l]of Object.entries(e))Mh(l,`${n}.${a}`,r,i)}s(mo,"checkBody");function vq(e,n,t,r){if(e===void 0)return;if(!Array.isArray(e)){r.push({path:n,code:"bodyShape",message:{de:`${n}: erwartet eine Liste.`,en:`${n}: expects a list.`}});return}let i=new Set;e.forEach((o,a)=>{let l=`${n}[${a}]`;if(!Ht(o)||!fr(o.fieldId)){r.push({path:l,code:"aifShape",message:{de:`${l}: \`fieldId\` fehlt.`,en:`${l}: \`fieldId\` is missing.`}});return}i.has(o.fieldId)&&r.push({path:l,code:"aifDuplicate",message:{de:`${l}: \u201E${o.fieldId}" doppelt.`,en:`${l}: "${o.fieldId}" appears twice.`}}),i.add(o.fieldId),Mh(o.value,`${l}.value`,t,r),o.unless!==void 0&&Mh(o.unless,`${l}.unless`,t,r,"condition")})}s(vq,"checkAif");function aS(e){let n=[];if(!Ht(e))return[{path:"engage",code:"missing",message:{de:"Die Engage-Zuordnung `engage` fehlt.",en:"The Engage mapping `engage` is missing."}}];let t=Ht(e.lookups)?e.lookups:{};Ht(e.lookups)||n.push({path:"engage.lookups",code:"bodyShape",message:{de:"`engage.lookups` fehlt (Tabellen Name \u2192 Plexus-Wert \u2192 Engage-Id).",en:"`engage.lookups` is missing (tables name \u2192 Plexus value \u2192 Engage id)."}});for(let[r,i]of Object.entries(t))(!Ht(i)||!Object.values(i).every(fr))&&n.push({path:`engage.lookups.${r}`,code:"lookupShape",message:{de:`Lookup \u201E${r}": jede Engage-Id ist ein nicht leerer Text.`,en:`Lookup "${r}": every Engage id is a non-empty text.`}});if(fr(e.addressFormatId)||n.push({path:"engage.addressFormatId",code:"missing",message:{de:"`engage.addressFormatId` fehlt (GetAddressMappingInfo).",en:"`engage.addressFormatId` is missing (GetAddressMappingInfo)."}}),mo(e.pupil,"engage.pupil","addPupil",t,n),mo(e.admission,"engage.admission","addAdmissionDetails",t,n),e.nationality!==void 0&&mo(e.nationality,"engage.nationality","addNationality",t,n),e.visa!==void 0&&mo(e.visa,"engage.visa","addVisa",t,n),e.medical!==void 0&&mo(e.medical,"engage.medical","addMedical",t,n),vq(e.pupilAif,"engage.pupilAif",t,n),!Array.isArray(e.contacts))n.push({path:"engage.contacts",code:"bodyShape",message:{de:"`engage.contacts` fehlt (Liste der Kontakte).",en:"`engage.contacts` is missing (list of contacts)."}});else{let r=new Set;e.contacts.forEach((i,o)=>{let a=`engage.contacts[${o}]`;if(!Ht(i)||!fr(i.key)||!fr(i.presentIf)){n.push({path:a,code:"contactShape",message:{de:`${a}: \`key\` und \`presentIf\` fehlen.`,en:`${a}: \`key\` and \`presentIf\` are missing.`}});return}r.has(i.key)&&n.push({path:a,code:"contactDuplicate",message:{de:`${a}: Kontakt \u201E${i.key}" doppelt.`,en:`${a}: contact "${i.key}" appears twice.`}}),r.add(i.key),mo(i.basic,`${a}.basic`,"addContact",t,n),i.address!==void 0&&mo(i.address,`${a}.address`,"addContactAddress",t,n);for(let[l,d]of[["emails","addContactEmail"],["telephones","addContactTelephone"]]){let c=i[l];if(c!==void 0){if(!Array.isArray(c)){n.push({path:`${a}.${l}`,code:"bodyShape",message:{de:`${a}.${l}: erwartet eine Liste.`,en:`${a}.${l}: expects a list.`}});continue}c.forEach((u,p)=>mo(u,`${a}.${l}[${p}]`,d,t,n))}}vq(i.aif,`${a}.aif`,t,n),i.linkAddressToPupilIf!==void 0&&Mh(i.linkAddressToPupilIf,`${a}.linkAddressToPupilIf`,t,n,"condition")})}if(e.siblingsAttending!==void 0){let r=e.siblingsAttending;(!Ht(r)||!fr(r.repeated)||!fr(r.field)||!fr(r.equals))&&n.push({path:"engage.siblingsAttending",code:"bodyShape",message:{de:"`engage.siblingsAttending` braucht repeated, field und equals.",en:"`engage.siblingsAttending` needs repeated, field and equals."}})}return n}s(aS,"engagePushConfigIssues");function*lS(e){let n=[e.pupil,e.admission,e.nationality,e.visa,e.medical];for(let t of n)for(let r of Object.values(t??{}))yield{mapping:r};for(let t of e.pupilAif??[])yield{mapping:t.value},t.unless!==void 0&&(yield{mapping:t.unless});for(let t of e.contacts){let r=[t.basic,t.address,...t.emails??[],...t.telephones??[]];for(let i of r)for(let o of Object.values(i??{}))yield{mapping:o,contactKey:t.key};for(let i of t.aif??[])yield{mapping:i.value,contactKey:t.key},i.unless!==void 0&&(yield{mapping:i.unless,contactKey:t.key});t.linkAddressToPupilIf!==void 0&&(yield{mapping:t.linkAddressToPupilIf,contactKey:t.key})}}s(lS,"mappingsOf");function xq(e){let n=new Set(e.contacts.map(t=>t.presentIf));for(let{mapping:t,contactKey:r}of lS(e))for(let i of t9(t.from))n.add(r9(i,r));return[...n]}s(xq,"configFieldKeys");function t9(e){return"field"in e?[e.field]:"join"in e?e.join:[]}s(t9,"formFieldsOf");function r9(e,n){return e.startsWith(".")?(n===void 0&&F(`[engagePush] relative field "${e}" outside a contact`),`${n}${e}`):e}s(r9,"resolveFieldKey");function Sq(e,n){for(let{mapping:t}of lS(e))if(n in t.from)return!0;return!1}s(Sq,"configReadsSource");function Aq(e){let n=new Set;for(let{mapping:t}of lS(e))"address"in t.from&&n.add(t.from.address.key);return[...n]}s(Aq,"configEnvLeaves");var Eq="done",Tq=["sandbox","production"];var qh="engagePush",bMe=660*1e3;function ho(e,n,t,r="error"){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:r}}s(ho,"issue");function dS(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(dS,"literal");function Rq(e){return aS(e.engage).length===0?e.engage:null}s(Rq,"validConfig");function i9(e,n){let t=new Map(e.nodes.map(a=>[a.id,a])),r=e.nodes.filter(a=>a.type==="eventTrigger"),i=new Set,o=r.map(a=>a.id);for(;o.length>0;){let a=o.pop();if(a===n||i.has(a))continue;i.add(a);let l=t.get(a);if(l!==void 0){if(l.type==="end"){let d=l.inputs?.applicationOutcome;if(d?.kind==="literal"&&d.value==="approved")return!0;continue}for(let d of Object.values(l.next??{})){let c=d?.to;typeof c=="string"&&o.push(c)}}}return!1}s(i9,"bypassingPath");var $q={role:"system-action",effect:"side-effect",outcomes:[{id:Eq,label:{de:"Angesto\xDFen",en:"Started"}}],envReads:s(e=>{let n=Rq(e);return n===null?[]:Aq(n)},"envReads"),inputs:s(()=>[{id:"target",label:{de:"Ziel-Engage",en:"Target Engage"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"sandbox",label:{de:"Sandbox",en:"Sandbox"}},{value:"production",label:{de:"Produktion",en:"Production"}}]},{id:"contractFields",label:{de:"Vertragsfelder F01\u2013F25",en:"Contract fields F01\u2013F25"},type:"enum",required:!1,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"off",label:{de:"Nicht \xFCbertragen (Bedeutung offen)",en:"Do not transfer (meaning open)"}},{value:"on",label:{de:"\xDCbertragen",en:"Transfer"}}]}],"inputs"),validate:s((e,n,t)=>{let r=e.label?.de??e.id,i=e.label?.en||e.id,o=[],a=dS(e,"target");Tq.includes(a)||o.push(ho(e,"inputs.target",{de:`[engagePush/invalidTarget] \u201E${r}": das Ziel ist sandbox oder production.`,en:`[engagePush/invalidTarget] "${i}": the target is sandbox or production.`}));let l=dS(e,"contractFields");l!==void 0&&l!=="off"&&l!=="on"&&o.push(ho(e,"inputs.contractFields",{de:`[engagePush/contractFields] \u201E${r}": Vertragsfelder sind off oder on.`,en:`[engagePush/contractFields] "${i}": contract fields are off or on.`})),e.assign?.[qh]===void 0&&o.push(ho(e,"assign",{de:`[engagePush/assign] \u201E${r}": wer eine stehen gebliebene \xDCbertragung pr\xFCft, fehlt \u2014 \`assign.${qh}\` nennt das Team.`,en:`[engagePush/assign] "${i}": nobody is set to check a stalled transfer \u2014 \`assign.${qh}\` names the team.`}));for(let k of aS(e.engage))o.push(ho(e,k.path,{de:`[engagePush/config] \u201E${r}": ${k.message.de}`,en:`[engagePush/config] "${i}": ${k.message.en}`}));let d=n.nodes.filter(k=>k.id!==e.id&&k.type==="engagePush"&&dS(k,"target")===a);d.length>0&&o.push(ho(e,"inputs.target",{de:`[engagePush/twice] \u201E${r}": ${d.map(k=>`"${k.id}"`).join(", ")} \xFCbertr\xE4gt schon an dasselbe Ziel.`,en:`[engagePush/twice] "${i}": ${d.map(k=>`"${k.id}"`).join(", ")} already transfers to the same target.`})),i9(n,e.id)&&o.push(ho(e,"next",{de:`[engagePush/bypassed] \u201E${r}": ein Weg erreicht ein \u201Eangenommen"-Ende, ohne durch die Engage-\xDCbertragung zu laufen \u2014 was dort angenommen wird, k\xE4me nie in Engage an.`,en:`[engagePush/bypassed] "${i}": a path reaches an "accepted" end without passing through the Engage transfer \u2014 what is accepted there would never reach Engage.`}));let c=Rq(e),u=e;for(let[k,w,b,T]of[["contract","contract","Vertrag","Contract"],["payment","payment","Zahlung","Payment"]])c===null||!Sq(c,k)||u[w]!==void 0||o.push(ho(e,w,{de:da("address/missing",{where:`\u201E${r}\u201C \u203A ${b}`},"de"),en:da("address/missing",{where:`"${i}" \u203A ${T}`},"en")}));let p=u.form,h=we(p)&&p.scope==="node"?p.owner:void 0,y=h===void 0?void 0:t?.readinessFormFieldsByFormNode?.get(h);if(c!==null&&y!==void 0){let k=new Set(y.keys()),w=xq(c).filter(b=>!k.has(b)&&!/\[\d+\]\./.test(b));if(w.length>0){let b=n.nodes.find(T=>T.id===h);o.push(ho(e,"engage",{de:`[engagePush/unmappedField] \u201E${r}": diese Felder kennt das Formular \u201E${b?.label?.de??h}" nicht \u2014 sie werden nicht \xFCbertragen: ${w.join(", ")}.`,en:`[engagePush/unmappedField] "${i}": the form "${b?.label?.en||h}" does not know these fields \u2014 they are not transferred: ${w.join(", ")}.`},"warning"))}}return o},"validate")};var ys={join:nM,end:rN,roleAssign:rM,eventTrigger:iM,waitlist:bM,completenessCheck:$M,form:uM,setFlag:fM,if:pM,decision:gs,review:OM,collectPayment:FM,governedDocument:kq,countersign:_D,engagePush:$q};N_(ys);function Iq(e,n){let t=e;if(t==null||!Array.isArray(t.nodes))throw new Error(`offer plan: the ${n} carries no workflow graph with nodes`);return e}s(Iq,"graphOf");function Oq(e){let n=new Map;for(let t of e.nodes)for(let r of Zr(e,t))n.set(de(r.address),r.nodeId);return n}s(Oq,"producedOf");function _q(e){let n=new Map;for(let t of e.nodes)n.set(t.id,new Set(Bo(e,t).map(r=>de(r.address))));return n}s(_q,"readsOf");function Pq(e,n){let t=Iq(e,"bundle"),r=Iq(n.graph,"live head"),i=Oq(t),o=Oq(r),a={added:[],removed:[],moved:[]};for(let[u,p]of i){let h=o.get(u);h===void 0?a.added.push({address:u,nodeId:p}):h!==p&&a.moved.push({address:u,from:h,to:p})}for(let[u,p]of o)i.has(u)||a.removed.push({address:u,nodeId:p});let l=_q(t),d=_q(r),c=[];for(let u of new Set([...l.keys(),...d.keys()])){let p=l.get(u)??new Set,h=d.get(u)??new Set,y=[...p].filter(w=>!h.has(w)),k=[...h].filter(w=>!p.has(w));(y.length>0||k.length>0)&&c.push({nodeId:u,added:y,removed:k})}return{headRevision:n.revision,pinnedApplications:n.pinnedApplications,produced:a,reads:c}}s(Pq,"planAddresses");function Nq(e){let n=[...e.produced.moved.map(i=>({icon:"~",target:`address:${i.address}`,status:`Knoten ${i.from} \u2192 ${i.to}`})),...e.produced.added.map(i=>({icon:"+",target:`address:${i.address}`,status:`neu (${i.nodeId})`})),...e.produced.removed.map(i=>({icon:"-",target:`address:${i.address}`,status:`entfernt (${i.nodeId})`})),...e.reads.map(i=>({icon:"~",target:`reads:${i.nodeId}`,status:[i.added.length>0?`+${i.added.join(", ")}`:"",i.removed.length>0?`\u2212${i.removed.join(", ")}`:""].filter(Boolean).join(" ")}))];if(n.length===0)return[];let{real:t,test:r}=e.pinnedApplications;return n.push({icon:"!",target:"pinned",status:`${t+r} Anmeldungen (${t} echt, ${r} Test) auf Fassung ${e.headRevision} bleiben auf ihrer Version \u2014 Umpinnen nur per Migration mit Abbildung`}),n}s(Nq,"addressPlanRows");function Cq(e,n){return n==null?!0:Pe(e)!==Pe(n)}s(Cq,"changed");async function Dq(e,n,t){if(n.index.module!==Ax.name)throw new Error(`offer: unknown module "${n.index.module}"`);return uF(e,n,t,{afterManifestPublish:s(async()=>{if(n.index.links?.unitKey||n.index.program)return Ax.scaffold(e,n.index.slugs.manifest,n.index,{dryRun:t.dryRun??!1})},"afterManifestPublish")})}s(Dq,"applyOffer");async function Fq(e,n,t,r="published"){let i=await e.query(x.setup.offerBundle.exportOfferBundle,{client:n,offerKey:t,generation:r});return{bundle:i.bundle,generation:i.generation,revision:i.revision}}s(Fq,"exportOffer");async function cS(e,n){let{index:t}=n,i=(await e.query(x.workflow.listManifests,{client:t.tenant})).find(y=>y.offerKey===t.slugs.manifest),o="create";i&&(o="same");let a={};for(let[y,k]of Object.entries(n.smartforms??{})){let w=i?await e.query(x.forms.getSmartFormBySlug,{client:t.tenant,offerVersionId:i.offerVersionId,slug:y}):null;a[y]=w?.def?Cq(k,{label:w.def.label,...w.def.definition})?"change":"same":"create"}let l="absent",d=null;if(n.workflow!==void 0){if(l="create",i?.workflowDefinitionId){let y=await e.query(x.workflow.getWorkflowDef,{workflowDefinitionId:i.workflowDefinitionId}),k=y?.publishedVersion??y?.draftVersion;l=Cq(k&&{graph:Qs(n.workflow.graph),progressLayout:n.workflow.progressLayout??k.progressLayout,progressWiring:n.workflow.progressWiring??k.progressWiring},k&&{graph:Qs(k.graph),progressLayout:k.progressLayout,progressWiring:k.progressWiring})?"change":"same"}if(i){let y=await e.query(x.workflow.getOfferHeadPins,{client:t.tenant,offerKey:t.slugs.manifest});y!==null&&(d=Pq(n.workflow.graph,y))}}let c=t.program?.stages,u=c===void 0?[]:i?await Sx(e,t.tenant,t.slugs.manifest,c):rp(null,[],c),p=await Ah(e,t.tenant,i?t.slugs.manifest:null,t),h=i?await e.query(x.workflow.getOfferPublishState,{client:t.tenant,offerKey:t.slugs.manifest}):null;return{manifest:o,smartforms:a,workflow:l,addresses:d,stages:u,capacities:p,publishPending:h?.draftDiffersFromExternal??null,draftRevision:h?.draftRevision??null,externalHeadRevision:h?.externalHeadRevision??null}}s(cS,"diffOffer");function Kh(e){if(e.type==="governedDocument"){let n=e.production;return n==="resolver"?"resolver":n==="template"?"template":n==="upload"||n==="none"?"manual":"unauthored"}return null}s(Kh,"contractProductionModeOf");function Lq(e){return Kh(e)==="resolver"}s(Lq,"isResolverCarrierNode");function jh(e){return(e.workflow?.graph?.nodes??[]).flatMap(t=>{let r=mi(t);return!Lq(t)||r===null?[]:[{node:t,key:r.key,kind:r.kind,...r.revision===void 0?{}:{revision:r.revision}}]})}s(jh,"authoredPins");var Mq={type:"address",dataType:"composite"};var qq={type:"boolean",dataType:"boolean"};var Kq={type:"consent",dataType:"boolean"};var jq={type:"date",dataType:"date"};var Vq={type:"docRef",dataType:"file"};var Bq={type:"email",dataType:"text"};var Uq={type:"string",dataType:"text"};var Gq={type:"tel",dataType:"text"};var Vh={address:Mq.dataType,boolean:qq.dataType,consent:Kq.dataType,date:jq.dataType,docRef:Vq.dataType,email:Bq.dataType,enum:KP.dataType,string:Uq.dataType,tel:Gq.dataType};function uS(e){return{type:e.type,multiple:e.multiple===!0,enumListKey:e.enumListKey,enumOptions:e.enumOptions}}s(uS,"shapeOf");function zq(e){let n=new Map,t=[],r=s(o=>{o.fields.forEach(a=>n.set(a.key,uS(a))),o.groups?.forEach(a=>a.fields.forEach(l=>n.set(l.key,uS(l)))),o.repeated?.forEach(a=>t.push({key:a.key,itemTemplate:a.itemTemplate,effects:a.effects??[]})),o.subsections?.forEach(r)},"visit");e.sections.forEach(r);let i=[{pathPrefix:"",effects:e.effects??[],shapes:n}];for(let o of t){let a=new Map(n);o.itemTemplate.forEach(l=>a.set(`$item.${l.key}`,uS(l))),i.push({pathPrefix:`repeated '${o.key}'.`,effects:o.effects,shapes:a})}return i}s(zq,"fieldMapScopes");function o9(e){let n=new Set,t=s(r=>{r.computed?.forEach(i=>n.add(i.key)),r.subsections?.forEach(t)},"visit");return e.sections.forEach(t),n}s(o9,"computedKeysOf");function Wq(e){let n=[],t=o9(e);for(let r of zq(e))r.effects.forEach((i,o)=>{if(i.kind!=="fieldMap")return;let a=new Map;i.mappings.forEach((l,d)=>{let c=`${r.pathPrefix}effects[${o}].mappings[${d}]`;t.has(l.from)&&n.push({severity:"error",path:`${c}.from`,code:"fieldmap.computed-source",message:`Effect '${i.id}' fieldMap '${l.from}' \u2192 '${l.to}': '${l.from}' is a computed field. Its value is derived, never stored, and would never reach the party.`});let u=a.get(l.to);u!==void 0&&u!==l.from?n.push({severity:"error",path:`${c}.to`,code:"fieldmap.duplicate-target",message:`Effect '${i.id}' maps both '${u}' and '${l.from}' onto custom field '${l.to}'. One party field holds one value \u2014 the write would keep one and drop the other.`}):a.set(l.to,l.from)})});return n}s(Wq,"validateFieldMapSources");function Yq(e){let n=[],t=new Set;for(let o of zq(e))for(let a of o.effects)if(a.kind==="fieldMap")for(let l of a.mappings)t.add(l.from);let r=s((o,a)=>{let l=a.some(d=>t.has(d));o.kind==="cf_value"&&!l?n.push({severity:"error",path:`field '${o.key}'`,code:"persist.cf-unmapped",message:`Field '${o.key}' declares kind 'cf_value' but is not the source of any fieldMap mapping. Either wire a fieldMap ('${o.key}' \u2192 a custom-field key) or set kind: 'control'.`}):o.kind==="control"&&l&&n.push({severity:"error",path:`field '${o.key}'`,code:"persist.control-mapped",message:`Field '${o.key}' declares kind 'control' but is used as a fieldMap source, which would persist it. Set kind: 'cf_value', or remove the fieldMap mapping (a control field may still feed OutcomeDef.output.fields).`})},"check"),i=s(o=>{o.fields.forEach(a=>r(a,[a.key])),o.groups?.forEach(a=>a.fields.forEach(l=>r(l,[l.key]))),o.repeated?.forEach(a=>a.itemTemplate.forEach(l=>r(l,[`$item.${l.key}`,l.key]))),o.subsections?.forEach(i)},"visit");return e.sections.forEach(i),n}s(Yq,"validateFieldPersistence");var s9="$";function a9(e){return typeof e=="string"&&e.startsWith(s9)}s(a9,"isRef");function Bh(e){return e.slice(1)}s(Bh,"stripRef");function*l9(e){switch(e.kind){case"relationship":if(yield e.from,yield e.to,e.meta)for(let n of Object.values(e.meta))yield n;return;case"fieldMap":yield e.target;return;case"shareValue":yield e.from,yield e.to;return;case"person":case"organization":return}}s(l9,"refSlots");function d9(e){let n=new Set;for(let t of l9(e))a9(t)&&n.add(Bh(t));return[...n]}s(d9,"collectRefs");function c9(e){let n=new Set(e.map(o=>o.id)),t=new Map,r=new Map,i=new Map;for(let o of e)i.set(o.id,o),t.set(o.id,[]),r.set(o.id,[]);for(let o of e)for(let a of d9(o))n.has(a)&&(t.get(o.id).push(a),r.get(a).push(o.id));for(let o of e){if(o.kind!=="shareValue")continue;let a=Bh(o.from);for(let l of e)l.id===o.id||!(l.kind==="fieldMap"&&Bh(l.target)===a||l.kind==="shareValue"&&Bh(l.to)===a)||t.get(o.id).includes(l.id)||(t.get(o.id).push(l.id),r.get(l.id).push(o.id))}return{refsOf:t,successors:r,byId:i}}s(c9,"buildAdjacency");function Hq(e){let{refsOf:n}=c9(e),r=fm(e.map(i=>i.id),i=>(n.get(i)??[]).map(o=>({target:o,edge:null})))[0];return r===void 0?{hasCycle:!1}:{hasCycle:!0,cycle:r.cycle}}s(Hq,"detectCycle");function Jq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(Jq,"escapeRegExp");function go(e){return new RegExp(`^${Jq(e)}\\[(\\d+)\\]\\.(.+)$`)}s(go,"repeatedRowKeyPattern");function fS(e,n){let t=go(n),r=0;for(let i of Object.keys(e)){let o=i.match(t);if(!o)continue;let a=Number(o[1]);Number.isInteger(a)&&a+1>r&&(r=a+1)}return r}s(fS,"countRepeatedRows");function Qq(e,n,t){let r=go(n);for(let[i,o]of Object.entries(e)){let a=i.match(r);if(!(!a||Number(a[1])!==t)&&o!=null&&!(typeof o=="string"&&o.trim()==="")&&!(Array.isArray(o)&&o.length===0))return!0}return!1}s(Qq,"repeatedRowHasData");function Zq(e){return e.endsWith(".count")?e.slice(0,-6):e}s(Zq,"readKeyOf");function pS(e){return{sections:e,fields:[]}}s(pS,"hiddenSectionsOnly");function Xq(e,n,t){for(let r of e.fields)n.add(r.key);for(let r of e.groups??[])for(let i of r.fields)n.add(i.key);for(let r of e.computed??[])n.add(r.key);for(let r of e.repeated??[])t.add(r.key);for(let r of e.subsections??[])Xq(r,n,t)}s(Xq,"collectKeys");function eK(e){let n=[],t=s(r=>{if(r.visibleTo!==void 0){let i=new Set,o=new Set;Xq(r,i,o),n.push({sectionId:r.id,label:r.label,visibleTo:r.visibleTo,fieldKeys:i,repeatedKeys:o,rowKeyPatterns:[...o].map(go)});return}for(let i of r.subsections??[])t(i)},"visit");for(let r of e.sections)t(r);return n}s(eK,"restrictedSectionsOf");function nK(e,n){return n.fieldKeys.has(e)||n.repeatedKeys.has(e)?!0:n.rowKeyPatterns.some(t=>t.test(e))}s(nK,"matchesKey");function u9(e,n){return n.find(t=>nK(e,t))??null}s(u9,"hiddenSectionOfKey");function f9(e,n){for(let t=e;;){if(nK(t,n))return!0;let r=t.lastIndexOf(".");if(r===-1)return!1;t=t.slice(0,r)}}s(f9,"fieldOwnsKey");function p9(e,n){return n.find(t=>f9(e,t))??null}s(p9,"restrictedFieldOfKey");function m9(e,n){let t=u9(e,n.sections);if(t!==null)return{kind:"section",section:t};let r=p9(e,n.fields);return r===null?null:{kind:"field",field:r}}s(m9,"hiddenOwnerOfKey");function Uh(e,n){return m9(e,n)!==null}s(Uh,"isKeyHidden");function h9(e,n,t,r,i){let o=[];r&&o.push({severity:"error",path:t,code:"section.visibleTo-nested",message:{de:`Abschnitt '${e}' liegt in einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo) und darf selbst keine tragen.`,en:`Section '${e}' sits inside a section with restricted visibility (visibleTo) and may not carry one itself.`}});let a=s(l=>typeof l!="string"||l.trim()==="","isBlank");if((n.length===0||n.some(a)||new Set(n).size!==n.length)&&o.push({severity:"error",path:t,code:"section.visibleTo-invalid",message:{de:`Abschnitt '${e}': visibleTo braucht mindestens ein Team, ohne leere oder doppelte Eintr\xE4ge.`,en:`Section '${e}': visibleTo needs at least one team, with no blank or repeated entries.`}}),i===void 0)return o;for(let l of n)a(l)||i.has(l)||o.push({severity:"error",path:t,code:"section.visibleTo-unknown",message:{de:`Abschnitt '${e}': '${l}' ist weder ein Team noch eine Rechtegruppe dieser Schule.`,en:`Section '${e}': '${l}' is neither a team nor a permission group of this school.`}});return o}s(h9,"visibleToListIssues");function tK(e,n,t){let r=[],i=s((c,u,p)=>{let h=c.visibleTo;h!==void 0&&r.push(...h9(c.id,h,`${u}.visibleTo`,p,t));let y=p||h!==void 0;if(y){let k=[...c.fields,...(c.groups??[]).flatMap(w=>w.fields),...(c.repeated??[]).flatMap(w=>w.itemTemplate)];for(let w of k)w.kind==="cf_value"&&r.push({severity:"error",path:`${u}.fields`,code:"section.visibleTo-party",message:{de:`Feld '${w.key}' wird in die Personendaten \xFCbernommen und kann deshalb nicht in einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo) liegen.`,en:`Field '${w.key}' is carried into the person record and therefore cannot sit in a section with restricted visibility (visibleTo).`}})}(c.subsections??[]).forEach((k,w)=>i(k,`${u}.subsections[${w}]`,y))},"visitRaw");e.sections.forEach((c,u)=>i(c,`sections[${u}]`,!1));let o=eK(e);if(o.length===0)return r;let a=s((c,u,p)=>{if(c===void 0)return;let h=pS(p);for(let y of Ln(c)){let k=Zq(y);(Uh(y,h)||Uh(k,h))&&r.push({severity:"error",path:u,code:"section.visibleTo-read-outside",message:{de:`${u} liest '${y}' aus einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo) \u2014 wer den Abschnitt nicht sieht, bek\xE4me hier ein anderes Ergebnis.`,en:`${u} reads '${y}' from a section with restricted visibility (visibleTo) \u2014 whoever cannot see the section would get a different result here.`}})}},"checkAst"),l=s((c,u,p)=>{a(c.visibleIf,`${u}.visibleIf`,p),a(c.requiredIf,`${u}.requiredIf`,p),a(c.disabledIf,`${u}.disabledIf`,p),a(c.defaultValue,`${u}.defaultValue`,p),c.sameAs!==void 0&&Uh(c.sameAs.source,pS(p))&&r.push({severity:"error",path:`${u}.sameAs`,code:"section.visibleTo-read-outside",message:{de:`${u} \xFCbernimmt '${c.sameAs.source}' aus einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo).`,en:`${u} copies '${c.sameAs.source}' from a section with restricted visibility (visibleTo).`}})},"checkField"),d=s((c,u,p)=>{let h=c.visibleTo!==void 0?c.id:p,y=o.filter(k=>k.sectionId!==h);a(c.visibleIf,`${u}.visibleIf`,c.visibleTo!==void 0?o:y),c.fields.forEach((k,w)=>l(k,`${u}.fields[${w}]`,y)),c.groups?.forEach((k,w)=>{a(k.visibleIf,`${u}.groups[${w}].visibleIf`,y),k.fields.forEach((b,T)=>l(b,`${u}.groups[${w}].fields[${T}]`,y))}),c.repeated?.forEach((k,w)=>{a(k.itemVisibleIf,`${u}.repeated[${w}].itemVisibleIf`,y),k.itemTemplate.forEach((b,T)=>l(b,`${u}.repeated[${w}].itemTemplate[${T}]`,y))}),c.computed?.forEach((k,w)=>a(k.expression,`${u}.computed[${w}]`,y)),c.subsections?.forEach((k,w)=>d(k,`${u}.subsections[${w}]`,h))},"visitCompiled");return n.sections.forEach((c,u)=>d(c,`sections[${u}]`,null)),r}s(tK,"sectionVisibilityIssues");var ai="#";var rK=s(e=>{let n=Vb.find(t=>t.systemColumn===e);return n===void 0&&F(`[personName] no system field backs ${e}`),n.key},"keyOfColumn"),Nr={firstName:rK("persons.firstName"),lastName:rK("persons.lastName")};function iK(e,n){let t={firstName:[],lastName:[]},r=`$${e}`;for(let i of n)if(!(i.kind!=="fieldMap"||i.target!==r))for(let{from:o,to:a}of i.mappings??[])a===Nr.firstName?t.firstName.push(o):a===Nr.lastName&&t.lastName.push(o);return t}s(iK,"personNameKeys");function oK(e){return[...e.firstName,...e.lastName]}s(oK,"personNameKeyList");function sK(e){return e.firstName.length>0||e.lastName.length>0}s(sK,"hasPersonName");function Za(e,n=[],t){let r=[];return e.forEach((i,o)=>{let a=[...n,o];r.push({section:i,path:a,parentId:t});for(let l of Za(i.subsections??[],a,i.id))r.push(l)}),r}s(Za,"walkSections");function g9(e,n){for(let t of e.fields)if(t.key===n)return t;for(let t of e.groups??[])for(let r of t.fields)if(r.key===n)return r;for(let t of e.repeated??[])for(let r of t.itemTemplate)if(r.key===n)return r;return null}s(g9,"findFieldInSection");function aK(e,n){for(let t of Za(e.sections)){let r=g9(t.section,n);if(r)return{section:t.section,field:r}}return null}s(aK,"findField");var y9=["Baby","BookOpen","BriefcaseBusiness","Building2","FileText","GraduationCap","HeartHandshake","Scale","UserCheck","UserRound","Users","UsersRound"],w9=["blue","rose","amber","violet","teal","emerald","slate"];function lK(e){return y9.includes(e)}s(lK,"isBucketIconName");function dK(e){return w9.includes(e)}s(dK,"isBucketColorName");var k9="__clear__";function cK(e){return e===""?"empty":e===k9?"reserved":null}s(cK,"selectOptionValueDefect");var mS=gL.docRef.allowedMime;function gK(e,n={}){let t=$a(e).compiled,r=[],i=new Set,o=new Map,a=new Set,l=new Set,d=new Set,c=new Map,u=new Map;function p(I,O){if(i.has(I))return;i.add(I);let j=o.get(I.id);j&&j!==I?r.push({severity:"error",path:`sections[${O.join(".")}]`,code:"duplicate.section-id",message:{de:`Abschnitts-ID '${I.id}' ist mehrfach deklariert.`,en:`Section id '${I.id}' is declared more than once.`}}):o.set(I.id,I);let D=`sections[${O.join(".")}]`;I.fields.forEach((z,le)=>{Xa(a,z.key,`${D}.fields[${le}]`,"duplicate.field-key",r),l.add(z.key),u.set(z.key,z),c.set(z.key,gS(z)),z.externalFlag&&(z.type!=="boolean"&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"flag.not-boolean",message:{de:`Externes Flag '${z.key}' muss den Typ 'boolean' haben (ist '${z.type}').`,en:`External flag '${z.key}' must be type 'boolean' (got '${z.type}').`}}),z.reviewRequired!==void 0&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"review.on-flag",message:{de:`Externes Flag '${z.key}' ist als pr\xFCfpflichtig markiert \u2014 ein Flag setzt der Prozess, die Familie reicht nichts ein, was jemand pr\xFCfen k\xF6nnte.`,en:`External flag '${z.key}' is marked as requiring review \u2014 the process sets a flag, the family hands in nothing anyone could review.`}}),z.notice!==void 0&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"config.notice-on-flag",message:{de:`Externes Flag '${z.key}' tr\xE4gt einen Hinweis (notice) \u2014 ein Flag wird der Familie nie angezeigt, also auch sein Hinweis nicht.`,en:`External flag '${z.key}' carries a notice \u2014 a flag is never shown to the family, so neither is its notice.`}}),z.defaultValue==null&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"flag.missing-default",message:{de:`Externes Flag '${z.key}' muss einen defaultValue deklarieren (z. B. "false"), damit es standardm\xE4\xDFig verborgen ist.`,en:`External flag '${z.key}' must declare a defaultValue (e.g. "false") so it is hidden by default.`}})),r.push(...fK(z,`${D}.fields[${le}]`)),r.push(...uK(z,`${D}.fields[${le}]`))}),I.groups?.forEach((z,le)=>{z.fields.forEach((ce,De)=>{Xa(a,ce.key,`${D}.groups[${le}].fields[${De}]`,"duplicate.field-key",r),l.add(ce.key),u.set(ce.key,ce),c.set(ce.key,gS(ce)),ce.externalFlag&&r.push({severity:"error",path:`${D}.groups[${le}].fields[${De}]`,code:"flag.invalid-location",message:{de:`Externes Flag '${ce.key}' muss ein direktes Abschnittsfeld sein, kein Gruppenfeld.`,en:`External flag '${ce.key}' must be a direct section field, not a group field.`}}),r.push(...fK(ce,`${D}.groups[${le}].fields[${De}]`)),r.push(...uK(ce,`${D}.groups[${le}].fields[${De}]`))})}),I.repeated?.forEach((z,le)=>{z.itemTemplate.forEach((ce,De)=>{Xa(a,ce.key,`${D}.repeated[${le}].itemTemplate[${De}]`,"duplicate.field-key",r),c.set(ce.key,gS(ce)),ce.externalFlag&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"flag.invalid-location",message:{de:`Externes Flag '${ce.key}' muss ein direktes Abschnittsfeld sein, kein Feld einer Wiederholung.`,en:`External flag '${ce.key}' must be a direct section field, not a repeated item field.`}}),ce.export&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"export.in-repeated",message:{de:`Feld '${ce.key}' deklariert export in einem itemTemplate einer Wiederholung \u2014 ein zusammengesetztes Blatt gilt je Bewerbung, ein Zeilenfeld je Zeile.`,en:`Field '${ce.key}' declares export inside a repeated itemTemplate \u2014 a compound leaf is per-application, a row field is per-row.`}}),ce.sameAs&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"config.sameas-in-repeated",message:{de:`Feld '${ce.key}' deklariert sameAs in einem itemTemplate einer Wiederholung \u2014 nicht unterst\xFCtzt.`,en:`Field '${ce.key}' declares sameAs inside a repeated itemTemplate \u2014 not supported.`}}),ce.reviewRequired!==void 0&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"review.in-repeated",message:{de:`Feld '${ce.key}' ist in einem itemTemplate einer Wiederholung als pr\xFCfpflichtig markiert \u2014 ein Zeilenfeld hat je Zeile einen Wert, kein Feld der Bewerbung, das man einmal abhaken k\xF6nnte.`,en:`Field '${ce.key}' is marked as requiring review inside a repeated itemTemplate \u2014 a row field has one value per row, no field of the application to tick once.`}}),ce.notice!==void 0&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"config.notice-in-repeated",message:{de:`Feld '${ce.key}' tr\xE4gt einen Hinweis (notice) in einem itemTemplate einer Wiederholung \u2014 dort wird er nicht angezeigt. Den Hinweis an den Abschnitt setzen.`,en:`Field '${ce.key}' carries a notice inside a repeated itemTemplate \u2014 it is not shown there. Put the notice on the section.`}}),ce.type==="docRef"&&ce.docRefConstraints?.multiple===!0&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"config.docref-multiple-in-repeated",message:{de:`Feld '${ce.key}' setzt docRefConstraints.multiple in einem itemTemplate einer Wiederholung \u2014 ein Mehrfach-Upload ist nur als Abschnitts- oder Gruppenfeld m\xF6glich.`,en:`Field '${ce.key}' sets docRefConstraints.multiple inside a repeated itemTemplate \u2014 a multi-file upload is supported only as a section or group field.`}})})}),I.computed?.forEach(z=>{d.add(z.key),Xa(a,z.key,`${D}.computed[${z.key}]`,"duplicate.field-key",r),z.exportType==="consent"&&r.push({severity:"error",path:`${D}.computed[${z.key}]`,code:"config.consent-computed",message:{de:`Berechnetes Feld '${z.key}' ist als Zustimmung (consent) typisiert \u2014 eine Zustimmung gibt die Person selbst, keine Berechnung. exportType 'boolean' verwenden.`,en:`Computed '${z.key}' is typed as a consent \u2014 a consent is given by the person, never computed. Use exportType 'boolean'.`}}),z.export===!0&&z.exportType===void 0&&r.push({severity:"error",path:`${D}.computed[${z.key}]`,code:"export.computed-untyped",message:{de:`Berechnetes Feld '${z.key}' wird ohne exportType exportiert \u2014 string | number | boolean | date angeben.`,en:`Computed '${z.key}' is exported without an exportType \u2014 declare string | number | boolean | date.`}})}),I.subsections?.forEach((z,le)=>p(z,[...O,le]))}s(p,"visitRawSection"),e.sections.forEach((I,O)=>p(I,[O]));let h=new Set;t.effects.forEach((I,O)=>{Xa(h,I.id,`effects[${O}]`,"duplicate.effect-id",r)});let y=new Set;t.outcomes.forEach((I,O)=>{Xa(y,I.id,`outcomes[${O}]`,"duplicate.outcome-id",r)}),t.outcomes.forEach((I,O)=>{I.output.effectRefs?.forEach((j,D)=>{h.has(j.effect)||r.push({severity:"error",path:`outcomes[${O}].output.effectRefs[${D}]`,code:"ref.unknown-effect",message:{de:`Ergebnis '${I.id}' verweist auf den unbekannten Effekt '${j.effect}'.`,en:`Outcome '${I.id}' references unknown effect '${j.effect}'.`}})})}),t.outcomes.forEach((I,O)=>{I.output.fields?.forEach((j,D)=>{aK(t,j.path)||r.push({severity:"error",path:`outcomes[${O}].output.fields[${D}]`,code:"ref.unknown-field",message:{de:`Ergebnis '${I.id}' verweist auf das unbekannte Feld '${j.path}'.`,en:`Outcome '${I.id}' references unknown field '${j.path}'.`}})})});let k=new Set;for(let I of Za(t.sections))for(let O of I.section.repeated??[])k.add(`${O.key}.count`);for(let I of k)(a.has(I)||d.has(I))&&r.push({severity:"error",path:"sections",code:"duplicate.field-key",message:{de:`'${I}' ist zugleich ein deklarierter Schl\xFCssel und die abgeleitete Zeilenzahl einer Wiederholung \u2014 der abgeleitete Wert w\xFCrde stillschweigend gewinnen.`,en:`'${I}' is both a declared key and the derived row count of a repeated group \u2014 the derived value would silently win.`}});let w={known:new Set([...a,...d,...k]),declaredContext:new Set(e.env??[]),stageKeys:n.stageKeys};r.push(...EC(e)),r.push(...tK(e,t,n.visibleToKeys)),r.push(...lD(e));for(let I of Za(t.sections)){let O=I.section,j=`sections[${I.path.join(".")}]`;O.visibleIf&&(Cr(O.visibleIf,`${j}.visibleIf`,w,!1,r),el(O.visibleIf,`${j}.visibleIf`,c,r)),O.fields.forEach((D,z)=>hS(D,`${j}.fields[${z}]`,w,!1,c,r)),O.groups?.forEach((D,z)=>{D.visibleIf&&(Cr(D.visibleIf,`${j}.groups[${z}].visibleIf`,w,!1,r),el(D.visibleIf,`${j}.groups[${z}].visibleIf`,c,r)),D.fields.forEach((le,ce)=>hS(le,`${j}.groups[${z}].fields[${ce}]`,w,!1,c,r))}),O.repeated?.forEach((D,z)=>{D.itemVisibleIf&&(Cr(D.itemVisibleIf,`${j}.repeated[${z}].itemVisibleIf`,w,!0,r),el(D.itemVisibleIf,`${j}.repeated[${z}].itemVisibleIf`,c,r)),D.itemTemplate.forEach((le,ce)=>hS(le,`${j}.repeated[${z}].itemTemplate[${ce}]`,w,!0,c,r)),D.effects?.forEach((le,ce)=>{le.when&&Cr(le.when,`${j}.repeated[${z}].effects[${ce}].when`,w,!0,r)})}),O.computed?.forEach((D,z)=>Cr(D.expression,`${j}.computed[${z}].expression`,w,!1,r))}t.effects.forEach((I,O)=>{I.when&&Cr(I.when,`effects[${O}].when`,w,!1,r)}),t.outcomes.forEach((I,O)=>{Cr(I.when,`outcomes[${O}].when`,w,!1,r)});let b=new Set(t.outcomes.map(I=>I.id));function T(I,O){I.requiredFor&&I.requiredFor.forEach((j,D)=>{b.has(j)||r.push({severity:"error",path:`${O}.requiredFor[${D}]`,code:"ref.unknown-required-for-outcome",message:{de:`Feld "${I.key}": requiredFor verweist auf das unbekannte Ergebnis "${j}"`,en:`field "${I.key}": requiredFor references unknown outcome "${j}"`}})})}s(T,"checkRequiredFor");for(let I of Za(t.sections)){let O=I.section,j=`sections[${I.path.join(".")}]`;O.fields.forEach((D,z)=>T(D,`${j}.fields[${z}]`)),O.groups?.forEach((D,z)=>{D.fields.forEach((le,ce)=>T(le,`${j}.groups[${z}].fields[${ce}]`))}),O.repeated?.forEach((D,z)=>{D.itemTemplate.forEach((le,ce)=>T(le,`${j}.repeated[${z}].itemTemplate[${ce}]`))})}function E(I,O){let j=s((D,z)=>{let le=(D.type==="docRef"?D.docRefConstraints?.mimeType??[]:[]).filter(Ee=>!mS.includes(Ee));le.length>0&&r.push({severity:"error",path:z,code:"config.docref-type-outside-ceiling",message:{de:`Feld '${D.key}' erlaubt ${le.map(Ee=>`'${Ee}'`).join(", ")} \u2014 kein Dokument-Upload akzeptiert diesen Typ (erlaubt: ${mS.join(", ")}).`,en:`Field '${D.key}' allows ${le.map(Ee=>`'${Ee}'`).join(", ")} \u2014 no document upload accepts that type (allowed: ${mS.join(", ")}).`}});let ce=D.type==="docRef"?D.docRefConstraints?.minFiles:void 0;if(ce!==void 0){let Ee=D.docRefConstraints?.multiple===!0,hn=typeof ce=="number"&&Number.isInteger(ce)&&ce>=2;(!Ee||!hn)&&r.push({severity:"error",path:z,code:"config.docref-min-files",message:Ee?{de:`Feld '${D.key}' setzt docRefConstraints.minFiles auf ${JSON.stringify(ce)} \u2014 erlaubt ist eine ganze Zahl ab 2.`,en:`Field '${D.key}' sets docRefConstraints.minFiles to ${JSON.stringify(ce)} \u2014 it must be a whole number of at least 2.`}:{de:`Feld '${D.key}' setzt docRefConstraints.minFiles ohne docRefConstraints.multiple: true \u2014 eine Mindestanzahl gibt es nur bei einem Mehrfach-Upload.`,en:`Field '${D.key}' sets docRefConstraints.minFiles without docRefConstraints.multiple: true \u2014 a minimum count exists only on a multi-file upload.`}})}D.multiple===!0&&D.type!=="enum"&&r.push({severity:"error",path:z,code:"config.multiple-non-enum",message:{de:`Feld '${D.key}' setzt multiple: true, hat aber den Typ '${D.type}' \u2014 nur 'enum' unterst\xFCtzt Mehrfachauswahl.`+(D.type==="docRef"?" F\xFCr mehrere Dateien docRefConstraints.multiple: true verwenden.":""),en:`Field '${D.key}' sets multiple: true but is type '${D.type}' \u2014 only 'enum' supports multi-select.`+(D.type==="docRef"?" For several files use docRefConstraints.multiple: true.":"")}}),D.presentation==="yesNo"&&D.type!=="boolean"&&r.push({severity:"error",path:z,code:"config.yesno-non-boolean",message:{de:`Feld '${D.key}' setzt presentation: 'yesNo', hat aber den Typ '${D.type}' \u2014 nur 'boolean'-Felder lassen sich als Ja | Nein-Antwort darstellen.`,en:`Field '${D.key}' sets presentation: 'yesNo' but is type '${D.type}' \u2014 only 'boolean' fields can be drawn as the Yes | No answer.`}}),D.presentation==="yesNo"&&D.defaultValue!=null&&r.push({severity:"error",path:z,code:"config.yesno-default",message:{de:`Feld '${D.key}' ist eine Ja | Nein-Frage (presentation: 'yesNo') mit einem defaultValue \u2014 die Familie muss die Antwort selbst w\xE4hlen. Den defaultValue entfernen.`,en:`Field '${D.key}' is a Yes | No question (presentation: 'yesNo') with a defaultValue \u2014 the family must choose the answer themselves. Remove the defaultValue.`}}),r.push(...v9(D,z)),typeof D.minSelections=="number"&&typeof D.maxSelections=="number"&&D.minSelections>D.maxSelections&&r.push({severity:"error",path:z,code:"config.min-gt-max-selections",message:{de:`Feld '${D.key}' hat minSelections (${D.minSelections}) > maxSelections (${D.maxSelections}).`,en:`Field '${D.key}' has minSelections (${D.minSelections}) > maxSelections (${D.maxSelections}).`}}),r.push(...x9(D,z));let De=D.enumRef;De!==void 0&&r.push({severity:"error",path:`${z}.enumRef`,code:"config.enum-ref-retired",message:{de:`Feld '${D.key}' nennt den entfernten Options-Katalog (enumRef '${String(De)}'). Die Optionen im Formular angeben (enumOptions + enumOptionLabels) oder eine Liste des Mandanten binden (enumListKey).`,en:`Field '${D.key}' names the removed option catalog (enumRef '${String(De)}'). Author the options in the form (enumOptions + enumOptionLabels) or bind a tenant list (enumListKey).`}}),(D.enumOptions??[]).forEach((Ee,hn)=>{let Qe=cK(Ee);Qe!==null&&r.push({severity:"error",path:`${z}.enumOptions[${hn}]`,code:"config.enum-option-value",message:{de:Qe==="empty"?`Feld '${D.key}' hat einen leeren Enum-Optionswert \u2014 das Steuerelement kann ihn nicht tragen. Der Option einen Wert geben oder sie streichen: Ein Feld, das unbeantwortet bleiben darf, bietet bereits eine eigene Zeile zum Leeren.`:`Feld '${D.key}' hat den Enum-Optionswert '${Ee}', den die Einzelauswahl f\xFCr ihre Zeile zum Leeren reserviert. Die Option umbenennen.`,en:Qe==="empty"?`Field '${D.key}' has an empty enum option value \u2014 the control cannot carry it. Give the option a value, or drop it: a field that may be left unanswered already offers its own clear row.`:`Field '${D.key}' has the enum option value '${Ee}', which the single select reserves for its clear row. Rename the option.`}})}),(D.attachments??[]).forEach((Ee,hn)=>{if("storageId"in Ee){r.push({severity:"error",path:`${z}.attachments[${hn}]`,code:"config.attachment-source",message:{de:`Anhang des Felds '${D.key}' tr\xE4gt eine rohe 'storageId' \u2014 Anh\xE4nge nennen eine Bibliotheksdatei jetzt per 'fileKey' (plexus-cli files put, dann field attach --file-key).`,en:`Field '${D.key}' attachment carries a raw 'storageId' \u2014 attachments name a library file by 'fileKey' now (plexus-cli files put, then field attach --file-key).`}});return}let Qe=Ee.fileKey!==void 0&&Ee.fileKey!=="",Tn=Ee.url!==void 0&&Ee.url!=="";Qe===Tn&&r.push({severity:"error",path:`${z}.attachments[${hn}]`,code:"config.attachment-source",message:{de:`Anhang des Felds '${D.key}' muss genau eines von 'fileKey' oder 'url' setzen (hat ${Qe&&Tn?"beide":"keines"}).`,en:`Field '${D.key}' attachment must set exactly one of 'fileKey' or 'url' (got ${Qe&&Tn?"both":"neither"}).`}}),Ee.renderAs==="inlineLink"&&Ee.label===void 0&&r.push({severity:"error",path:`${z}.attachments[${hn}]`,code:"config.attachment-inline-link-label",message:{de:`inlineLink-Anhang des Felds '${D.key}' braucht ein 'label' \u2014 die verlinkte Wendung im Feldlabel.`,en:`Field '${D.key}' inlineLink attachment needs a 'label' \u2014 the linked phrase shown in the field label.`}})})},"considerField");I.fields.forEach((D,z)=>j(D,`${O}.fields[${z}]`)),I.groups?.forEach((D,z)=>{D.fields.forEach((le,ce)=>j(le,`${O}.groups[${z}].fields[${ce}]`))}),I.repeated?.forEach((D,z)=>{D.itemTemplate.forEach((le,ce)=>{let De=`${O}.repeated[${z}].itemTemplate[${ce}]`;j(le,De),le.type==="consent"&&r.push({severity:"error",path:De,code:"config.consent-in-repeated",message:{de:`Feld '${le.key}' ist eine Zustimmung in einem Wiederholungsblock \u2014 Zustimmungen stehen nur als Feld eines Abschnitts oder einer Gruppe.`,en:`Field '${le.key}' is a consent inside a repeated block \u2014 a consent stands only as a field of a section or a group.`}})})}),I.subsections?.forEach((D,z)=>E(D,`${O}.subsections[${z}]`))}s(E,"visitFieldConfig"),e.sections.forEach((I,O)=>E(I,`sections[${O}]`)),e.effects.forEach((I,O)=>{if(I.kind==="person"){r.push(...hK(I,e.effects,`effects[${O}]`,j=>l.has(j)));return}I.kind==="organization"&&I.nameFrom?.forEach((j,D)=>{l.has(j)||r.push({severity:"error",path:`effects[${O}].nameFrom[${D}]`,code:"ref.unknown-name-field",message:{de:`Effekt '${I.id}': nameFrom verweist auf das unbekannte Feld '${j}'.`,en:`Effect '${I.id}' nameFrom references unknown field '${j}'.`}})})});let $=s((I,O)=>{if(I.kind!=="person"&&I.kind!=="organization")return;let j=I.display;if(!j){r.push({severity:"error",path:`${O}.display`,code:"display.missing",message:{de:`Effekt '${I.id}' deklariert einen Partei-Bucket, aber kein display \u2014 Titel, Icon und Akzentfarbe der Partei w\xE4ren nicht aufl\xF6sbar.`,en:`Effect '${I.id}' declares a party bucket but no display \u2014 the party's title, icon and accent colour could not be resolved.`}});return}lK(j.icon)||r.push({severity:"error",path:`${O}.display.icon`,code:"display.unknown-icon",message:{de:`Effekt '${I.id}': display.icon '${j.icon}' ist kein bekanntes Bucket-Icon.`,en:`Effect '${I.id}' display.icon '${j.icon}' is not a known bucket icon.`}}),dK(j.color)||r.push({severity:"error",path:`${O}.display.color`,code:"display.unknown-color",message:{de:`Effekt '${I.id}': display.color '${j.color}' ist keine bekannte Bucket-Farbe.`,en:`Effect '${I.id}' display.color '${j.color}' is not a known bucket colour.`}})},"checkBucketDisplay");e.effects.forEach((I,O)=>$(I,`effects[${O}]`));let C=new Set,L=s(I=>{I.kind==="person"?C.add(I.bucket):I.kind==="organization"&&C.add(I.id.replace(/^o\./,""))},"declareBucket");e.effects.forEach(L);let _=new Set,v=s(I=>{for(let O of I)O.repeated?.forEach(j=>j.effects?.forEach(D=>L(D))),v(O.subsections??[])},"collectRepeatedBuckets");v(e.sections);let P=s((I,O)=>{C.size!==0&&I.forEach((j,D)=>{j.bucket===void 0||C.has(j.bucket)||r.push({severity:"error",path:`${O}[${D}].bucket`,code:"bucket.undeclared",message:{de:`Feld '${j.key}' geh\xF6rt zum Bucket '${j.bucket}', aber kein Person-/Organisations-Effekt deklariert ihn \u2014 das Feld geh\xF6rt zu keiner Partei.`,en:`Field '${j.key}' belongs to bucket '${j.bucket}', but no person/organization effect declares it \u2014 the field belongs to no party.`}})})},"checkFieldBuckets"),A=s((I,O)=>{if(_.has(I))return;_.add(I);let j=`sections[${O.join(".")}]`;P(I.fields,`${j}.fields`),I.groups?.forEach((D,z)=>P(D.fields,`${j}.groups[${z}].fields`)),I.repeated?.forEach((D,z)=>P(D.itemTemplate,`${j}.repeated[${z}].itemTemplate`)),I.subsections?.forEach((D,z)=>A(D,[...O,z]))},"visitBucketSection");e.sections.forEach((I,O)=>A(I,[O]));let M=e.effects.flatMap((I,O)=>I.kind==="person"&&I.subject===!0?[{e:I,i:O}]:[]);M.length>1&&M.slice(1).forEach(({e:I,i:O})=>{r.push({severity:"error",path:`effects[${O}].subject`,code:"subject.duplicate",message:{de:`Effekt '${I.id}' deklariert subject:true, aber '${M[0].e.id}' tut es bereits. Genau ein Bucket darf das Subjekt der Bewerbung sein.`,en:`Effect '${I.id}' declares subject:true, but '${M[0].e.id}' already does. Exactly one bucket may be the application subject.`}})}),e.effects.forEach((I,O)=>{if(!(I.kind!=="person"||I.nationalityFrom===void 0)){if(I.subject!==!0){r.push({severity:"error",path:`effects[${O}].nationalityFrom`,code:"nationality.not-subject",message:{de:`Effekt '${I.id}' deklariert nationalityFrom, ist aber nicht das Subjekt der Bewerbung \u2014 die Staatsangeh\xF6rigkeit wird nur f\xFCr das Subjekt der Bewerbung gelesen.`,en:`Effect '${I.id}' declares nationalityFrom but is not the application subject \u2014 nationality is read only for the application subject.`}});return}if(I.nationalityFrom.length===0){r.push({severity:"error",path:`effects[${O}].nationalityFrom`,code:"nationality.empty",message:{de:`Effekt '${I.id}' deklariert ein leeres nationalityFrom \u2014 weglassen oder mindestens ein Feld nennen.`,en:`Effect '${I.id}' declares an empty nationalityFrom \u2014 omit it or name at least one field.`}});return}I.nationalityFrom.forEach((j,D)=>{l.has(j)||r.push({severity:"error",path:`effects[${O}].nationalityFrom[${D}]`,code:"nationality.unknown-field",message:{de:`Effekt '${I.id}': nationalityFrom verweist auf das unbekannte Feld '${j}'.`,en:`Effect '${I.id}' nationalityFrom references unknown field '${j}'.`}})})}});let U=e.effects.flatMap((I,O)=>I.kind==="person"&&I.contractParty!==void 0?[{e:I,i:O,decl:I.contractParty}]:[]);if(U.length>0){let I=new Map;U.forEach(({e:j,i:D})=>{let z=I.get(j.bucket);if(z===void 0){I.set(j.bucket,j.id);return}r.push({severity:"error",path:`effects[${D}].contractParty`,code:"contractParty.duplicate-bucket",message:{de:`Effekt '${j.id}' deklariert eine Vertragspartei auf Bucket '${j.bucket}', aber '${z}' tut es bereits. Ein Bucket ist h\xF6chstens eine Vertragspartei.`,en:`Effect '${j.id}' declares a contract party on bucket '${j.bucket}', but '${z}' already does. A bucket is at most one contract party.`}})});let O=U.filter(({decl:j})=>j.role==="beneficiary");O.slice(1).forEach(({e:j,i:D})=>{r.push({severity:"error",path:`effects[${D}].contractParty.role`,code:"contractParty.duplicate-beneficiary",message:{de:`Effekt '${j.id}' deklariert contractParty.role 'beneficiary', aber '${O[0].e.id}' tut es bereits. Genau ein Bucket darf Leistungsempf\xE4nger sein.`,en:`Effect '${j.id}' declares contractParty.role 'beneficiary', but '${O[0].e.id}' already does. Exactly one bucket may be the beneficiary.`}})}),O.forEach(({e:j,i:D})=>{j.subject!==!0&&r.push({severity:"error",path:`effects[${D}].contractParty.role`,code:"contractParty.beneficiary-not-subject",message:{de:`Effekt '${j.id}' ist der Leistungsempf\xE4nger des Vertrags, aber nicht das Subjekt der Bewerbung. Leistungsempf\xE4nger und Subjekt der Bewerbung sind dieselbe Person \u2014 subject:true auf '${j.id}' setzen.`,en:`Effect '${j.id}' is the contract beneficiary but not the application subject. The beneficiary and the application subject are the same person \u2014 set subject:true on '${j.id}'.`}})}),M.forEach(({e:j,i:D})=>{let z=j.contractParty?.role;z!==void 0&&z!=="beneficiary"&&r.push({severity:"error",path:`effects[${D}].contractParty.role`,code:"contractParty.subject-role-mismatch",message:{de:`Effekt '${j.id}' ist das Subjekt der Bewerbung, deklariert aber contractParty.role '${z}'. Das Subjekt der Bewerbung ist der Leistungsempf\xE4nger des Vertrags.`,en:`Effect '${j.id}' is the application subject but declares contractParty.role '${z}'. The application subject is the contract beneficiary.`}})}),U.some(({decl:j})=>j.signs===!0)||r.push({severity:"error",path:"effects",code:"contractParty.no-signer",message:{de:"Das Formular deklariert Vertragsparteien, aber keine unterschreibt (contractParty.signs). Ein Vertrag ohne Unterzeichner kann nicht erzeugt werden.",en:"The form declares contract parties, but none signs (contractParty.signs). A contract without a signatory cannot be generated."}})}e.effects.forEach((I,O)=>{I.kind==="fieldMap"&&I.mappings.forEach((j,D)=>{a.has(j.from)||r.push({severity:"error",path:`effects[${O}].mappings[${D}].from`,code:"ref.unknown-fieldmap-from",message:{de:`Effekt '${I.id}': fieldMap from '${j.from}' verweist auf ein unbekanntes Feld.`,en:`Effect '${I.id}' fieldMap from '${j.from}' references unknown field.`}})})});for(let[I,O]of u){if(!O.sameAs)continue;let j=`fields[${I}].sameAs`,D=u.get(O.sameAs.source);D===void 0||O.sameAs.source===I?r.push({severity:"error",path:`${j}.source`,code:"ref.unknown-sameas-source",message:{de:O.sameAs.source===I?`Feld '${I}': sameAs.source verweist auf sich selbst.`:`Feld '${I}': sameAs.source verweist auf das unbekannte Feld '${O.sameAs.source}' (muss ein Abschnitts- oder Gruppenfeld sein).`,en:O.sameAs.source===I?`Field '${I}' sameAs.source references itself.`:`Field '${I}' sameAs.source references unknown field '${O.sameAs.source}' (must be a top-level or group field).`}}):D.type!==O.type?r.push({severity:"error",path:`${j}.source`,code:"ref.unknown-sameas-source",message:{de:`Feld '${I}' (${O.type}): sameAs.source '${O.sameAs.source}' hat einen anderen Typ (${D.type}) \u2014 die Spiegelung muss formgleich sein.`,en:`Field '${I}' (${O.type}) sameAs.source '${O.sameAs.source}' has a different type (${D.type}) \u2014 the mirror must be shape-identical.`}}):D.sameAs&&r.push({severity:"error",path:`${j}.source`,code:"ref.unknown-sameas-source",message:{de:`Feld '${I}': sameAs.source '${O.sameAs.source}' deklariert selbst sameAs \u2014 Spiegelketten werden nicht unterst\xFCtzt.`,en:`Field '${I}' sameAs.source '${O.sameAs.source}' itself declares sameAs \u2014 mirror chains are not supported.`}});let z=u.get(O.sameAs.toggle);(z===void 0||z.type!=="boolean")&&r.push({severity:"error",path:`${j}.toggle`,code:"ref.unknown-sameas-toggle",message:{de:z===void 0?`Feld '${I}': sameAs.toggle verweist auf das unbekannte Feld '${O.sameAs.toggle}'.`:`Feld '${I}': sameAs.toggle '${O.sameAs.toggle}' muss den Typ 'boolean' haben (ist '${z.type}').`,en:z===void 0?`Field '${I}' sameAs.toggle references unknown field '${O.sameAs.toggle}'.`:`Field '${I}' sameAs.toggle '${O.sameAs.toggle}' must be type 'boolean' (got '${z.type}').`}}),O.required===!0&&r.push({severity:"error",path:`fields[${I}].required`,code:"config.sameas-static-required",message:{de:`Feld '${I}' deklariert sameAs, ist aber statisch Pflicht \u2014 solange es gespiegelt ist, hat es keinen eigenen Wert, die Slice-Validierung beim Commit w\xFCrde immer scheitern. required: false + requiredIf: "${O.sameAs.toggle} != true" verwenden.`,en:`Field '${I}' declares sameAs but is statically required \u2014 while mirrored it holds no own value, so commit-time slice validation would always fail. Use required: false + requiredIf: "${O.sameAs.toggle} != true".`}})}{let I=new Map;e.effects.forEach(O=>I.set(O.id,O.kind)),e.effects.forEach((O,j)=>{if(O.kind!=="shareValue")return;[["from",O.from],["to",O.to]].forEach(([le,ce])=>{let De=I.get(ce.slice(1));De!==void 0&&De!=="person"&&De!=="organization"&&r.push({severity:"error",path:`effects[${j}].${le}`,code:"ref.sharevalue-endpoint",message:{de:`Effekt '${O.id}': shareValue ${le} '${ce}' muss auf einen Person-/Organisations-Effekt verweisen (ist '${De}').`,en:`Effect '${O.id}' shareValue ${le} '${ce}' must reference a person/organization effect (got '${De}').`}})});let D=O.from.slice(1);e.effects.some(le=>le.kind==="fieldMap"&&le.target.slice(1)===D&&le.mappings.some(ce=>ce.to===O.field)||le.kind==="shareValue"&&le.id!==O.id&&le.to.slice(1)===D&&le.field===O.field)||r.push({severity:"error",path:`effects[${j}].field`,code:"config.sharevalue-missing-source-map",message:{de:`Effekt '${O.id}' teilt das Feld '${O.field}' aus '${O.from}', aber kein fieldMap mit Ziel '${O.from}' bildet auf '${O.field}' ab (und kein shareValue verkn\xFCpft es) \u2014 der Quellwert k\xF6nnte beim Commit nie existieren.`,en:`Effect '${O.id}' shares field '${O.field}' from '${O.from}', but no fieldMap targeting '${O.from}' maps to '${O.field}' (and no shareValue links it in) \u2014 the source value could never exist at commit time.`}})})}e.effects.forEach((I,O)=>{I.kind==="person"&&I.bucket.includes(ai)&&r.push({severity:"error",path:`effects[${O}].bucket`,code:"config.bucket-name-contains-hash",message:{de:`Effekt '${I.id}': bucket '${I.bucket}' darf '${ai}' nicht enthalten (f\xFCr den Zeilen-Namensraum reserviert).`,en:`Effect '${I.id}' bucket '${I.bucket}' must not contain '${ai}' (reserved for the per-row namespace).`}}),I.kind==="organization"&&I.orgKind.includes(ai)&&r.push({severity:"error",path:`effects[${O}].orgKind`,code:"config.bucket-name-contains-hash",message:{de:`Effekt '${I.id}': orgKind '${I.orgKind}' darf '${ai}' nicht enthalten (f\xFCr den Zeilen-Namensraum reserviert).`,en:`Effect '${I.id}' orgKind '${I.orgKind}' must not contain '${ai}' (reserved for the per-row namespace).`}})});let oe=new Set;function Q(I,O){I.repeated?.forEach((j,D)=>{let z=j.effects??[];if(z.length>0){let le=`${O}.repeated[${D}]`,ce=new Set(z.map(se=>se.id)),De=new Set(j.itemTemplate.map(se=>se.key)),Ee=(j.uniqueBy?.length??0)>0,hn=s(se=>se.startsWith("$item.")?De.has(se.slice(6)):l.has(se),"resolvesName"),Qe=s(se=>se.startsWith("$item.")?De.has(se.slice(6)):a.has(se),"resolvesFrom"),Tn=s(se=>{let Wn=se.slice(1);return ce.has(Wn)||h.has(Wn)},"resolvesRef");z.forEach((se,Wn)=>{let gn=`${le}.effects[${Wn}]`;if(h.has(se.id)||oe.has(se.id)?r.push({severity:"error",path:gn,code:"duplicate.repeated-effect-id",message:{de:`Der Effekt '${se.id}' der Wiederholung ist mehrfach deklariert.`,en:`Repeated effect id '${se.id}' is declared more than once.`}}):oe.add(se.id),se.kind==="person"||se.kind==="organization"){$(se,gn),se.kind==="person"&&se.subject===!0&&r.push({severity:"error",path:`${gn}.subject`,code:"subject.in-repeated",message:{de:`Effekt '${se.id}' der Wiederholung deklariert subject:true \u2014 eine Zeile gilt je Zeile, das Subjekt der Bewerbung je Bewerbung. Das Subjekt an einem Effekt der obersten Ebene deklarieren.`,en:`Repeated effect '${se.id}' declares subject:true \u2014 a repeated row is per-row, the application subject is per-application. Declare the subject on a top-level effect.`}}),se.kind==="person"&&se.nationalityFrom!==void 0&&r.push({severity:"error",path:`${gn}.nationalityFrom`,code:"nationality.not-subject",message:{de:`Effekt '${se.id}' der Wiederholung deklariert nationalityFrom \u2014 nur das Subjekt der Bewerbung (ein Effekt der obersten Ebene) tr\xE4gt es.`,en:`Repeated effect '${se.id}' declares nationalityFrom \u2014 only the application subject (a top-level effect) carries it.`}}),se.kind==="person"&&se.contractParty!==void 0&&r.push({severity:"error",path:`${gn}.contractParty`,code:"contractParty.in-repeated",message:{de:`Effekt '${se.id}' der Wiederholung deklariert contractParty \u2014 wer unterschreibt, wird einmal je Bewerbung deklariert, nicht je Zeile. An einem Effekt der obersten Ebene deklarieren.`,en:`Repeated effect '${se.id}' declares contractParty \u2014 who signs is declared once per application, not once per row. Declare it on a top-level effect.`}}),Ee||r.push({severity:"error",path:le,code:"config.repeated-effect-requires-uniqueBy",message:{de:`Wiederholung '${j.key}' hat einen Parteien erzeugenden Effekt '${se.id}', aber kein 'uniqueBy' \u2014 Parteien je Zeile brauchen einen stabilen Identit\xE4tsschl\xFCssel.`,en:`Repeated def '${j.key}' has a party-creating effect '${se.id}' but no 'uniqueBy' \u2014 per-row parties need a stable identity key.`}});let Fe=se.kind==="person"?se.bucket:se.orgKind;Fe.includes(ai)&&r.push({severity:"error",path:`${gn}.${se.kind==="person"?"bucket":"orgKind"}`,code:"config.bucket-name-contains-hash",message:{de:`Effekt '${se.id}' der Wiederholung: ${se.kind==="person"?"bucket":"orgKind"} '${Fe}' darf '${ai}' nicht enthalten.`,en:`Repeated effect '${se.id}' ${se.kind==="person"?"bucket":"orgKind"} '${Fe}' must not contain '${ai}'.`}}),se.kind==="person"&&r.push(...hK(se,z,gn,hn)),se.kind==="organization"&&se.nameFrom?.forEach((Ge,Mt)=>{hn(Ge)||r.push({severity:"error",path:`${gn}.nameFrom[${Mt}]`,code:"ref.unknown-name-field",message:{de:`Effekt '${se.id}' der Wiederholung: nameFrom verweist auf das unbekannte Feld '${Ge}'.`,en:`Repeated effect '${se.id}' nameFrom references unknown field '${Ge}'.`}})}),se.identity?.strategy==="keyed"&&se.identity.keyFrom.forEach((Ge,Mt)=>{Qe(Ge)||r.push({severity:"error",path:`${gn}.identity.keyFrom[${Mt}]`,code:"ref.unknown-fieldmap-from",message:{de:`Effekt '${se.id}' der Wiederholung: identity.keyFrom verweist auf das unbekannte Feld '${Ge}'.`,en:`Repeated effect '${se.id}' identity.keyFrom references unknown field '${Ge}'.`}})})}else if(se.kind==="relationship"){if([["from",se.from],["to",se.to]].forEach(([Fe,Ge])=>{Tn(Ge)||r.push({severity:"error",path:`${gn}.${Fe}`,code:"ref.unknown-repeated-effect",message:{de:`Beziehung '${se.id}' der Wiederholung: ${Fe} verweist auf den unbekannten Effekt '${Ge}'.`,en:`Repeated relationship '${se.id}' ${Fe} references unknown effect '${Ge}'.`}})}),se.meta)for(let[Fe,Ge]of Object.entries(se.meta))typeof Ge=="string"&&Ge.startsWith("$")&&!Tn(Ge)&&r.push({severity:"error",path:`${gn}.meta.${Fe}`,code:"ref.unknown-repeated-effect",message:{de:`Beziehung '${se.id}' der Wiederholung: meta.${Fe} verweist auf den unbekannten Effekt '${Ge}'.`,en:`Repeated relationship '${se.id}' meta.${Fe} references unknown effect '${Ge}'.`}})}else se.kind==="fieldMap"?(Tn(se.target)||r.push({severity:"error",path:`${gn}.target`,code:"ref.unknown-repeated-effect",message:{de:`fieldMap '${se.id}' der Wiederholung: Ziel verweist auf den unbekannten Effekt '${se.target}'.`,en:`Repeated fieldMap '${se.id}' target references unknown effect '${se.target}'.`}}),se.mappings.forEach((Fe,Ge)=>{Qe(Fe.from)||r.push({severity:"error",path:`${gn}.mappings[${Ge}].from`,code:"ref.unknown-fieldmap-from",message:{de:`fieldMap '${se.id}' der Wiederholung: from '${Fe.from}' verweist auf ein unbekanntes Feld.`,en:`Repeated fieldMap '${se.id}' from '${Fe.from}' references unknown field.`}})})):se.kind==="shareValue"&&r.push({severity:"error",path:gn,code:"config.sharevalue-in-repeated",message:{de:`Effekt '${se.id}' der Wiederholung: shareValue wird in Effekten von Wiederholungszeilen nicht unterst\xFCtzt.`,en:`Repeated effect '${se.id}': shareValue is not supported inside repeated row effects.`}})})}}),I.subsections?.forEach((j,D)=>Q(j,`${O}.subsections[${D}]`))}s(Q,"visitRepeatedEffects"),e.sections.forEach((I,O)=>Q(I,`sections[${O}]`));let re=Hq(t.effects);return re.hasCycle&&r.push({severity:"error",path:"effects",code:"graph.effect-cycle",message:{de:`Der Effektgraph enth\xE4lt einen Zyklus: ${re.cycle?.join(" \u2192 ")??"?"}`,en:`Effect graph contains a cycle: ${re.cycle?.join(" \u2192 ")??"?"}`}}),r.push(...b9(e)),r}s(gK,"validateForm");function b9(e){let n={...e,effects:e.effects.map(yK),sections:e.sections.map(wK),testScenarios:e.testScenarios?.map(t=>({id:t.id,label:t.label,description:t.description}))};return wm(n,"form").map(t=>({severity:"error",path:t.path,code:"i18n.missing-translation",message:Uk(t)}))}s(b9,"missingTranslationIssues");function yK(e){if(!("subject"in e))return e;let{subject:n,...t}=e;return t}s(yK,"withoutSubjectFlag");function wK(e){return{...e,repeated:e.repeated?.map(n=>({...n,effects:n.effects?.map(yK)})),subsections:e.subsections?.map(wK)}}s(wK,"withoutRowSubjectFlags");function uK(e,n){let t=e.reviewRequired;return t===void 0||t===!0?[]:[{severity:"error",path:n,code:"review.shape",message:{de:`Feld '${e.key}' setzt reviewRequired auf ${JSON.stringify(t)} \u2014 erlaubt ist nur true; ein nicht pr\xFCfpflichtiges Feld l\xE4sst die Angabe weg.`,en:`Field '${e.key}' sets reviewRequired to ${JSON.stringify(t)} \u2014 only true is allowed; a field that needs no review omits it.`}}]}s(uK,"reviewRequiredShapeIssues");function fK(e,n){if(!e.export)return[];let t=[];return e.type==="docRef"&&t.push({severity:"error",path:n,code:"export.invalid-type",message:{de:`Feld '${e.key}' (docRef) kann nicht exportiert werden \u2014 ein Speicher-Handle ist kein bindbarer Dokumentwert.`,en:`Field '${e.key}' (docRef) cannot be exported \u2014 a storage handle is not a bindable document value.`}}),e.multiple===!0&&t.push({severity:"error",path:n,code:"export.multiple-enum",message:{de:`Feld '${e.key}' ist eine Mehrfachauswahl \u2014 N gew\xE4hlte Optionen sind kein einzelnes zusammengesetztes Blatt, deshalb nicht exportierbar.`,en:`Field '${e.key}' is a multi-select \u2014 N picked options are not one compound leaf, so it cannot be exported.`}}),t}s(fK,"exportGateIssues");function Xa(e,n,t,r,i){e.has(n)?i.push({severity:"error",path:t,code:r,message:{de:`Mehrfach vergeben: ${pK(r,"de")} '${n}'`,en:`Duplicate ${pK(r,"en")}: '${n}'`}}):e.add(n)}s(Xa,"reportIfDup");function pK(e,n){let t=s((r,i)=>n==="de"?r:i,"label");switch(e){case"duplicate.section-id":return t("Abschnitts-ID","section id");case"duplicate.field-key":return t("Feldschl\xFCssel","field key");case"duplicate.effect-id":return t("Effekt-ID","effect id");case"duplicate.outcome-id":return t("Ergebnis-ID","outcome id");case"ref.unknown-required-for-outcome":return t("requiredFor-Ergebnis","requiredFor outcome");default:return e}}s(pK,"labelForCode");function hS(e,n,t,r,i,o){e.visibleIf&&(Cr(e.visibleIf,`${n}.visibleIf`,t,r,o),el(e.visibleIf,`${n}.visibleIf`,i,o)),e.requiredIf&&(Cr(e.requiredIf,`${n}.requiredIf`,t,r,o),el(e.requiredIf,`${n}.requiredIf`,i,o)),e.disabledIf&&(Cr(e.disabledIf,`${n}.disabledIf`,t,r,o),el(e.disabledIf,`${n}.disabledIf`,i,o)),e.defaultValue&&Cr(e.defaultValue,`${n}.defaultValue`,t,r,o)}s(hS,"checkFieldAsts");function gS(e){return{hasDefault:e.defaultValue!=null,isBoolean:e.type==="boolean",isYesNo:e.type==="boolean"&&e.presentation==="yesNo",isConsent:e.type==="consent"}}s(gS,"gatingMeta");function el(e,n,t,r){function i(o){switch(o.kind){case"binary":{(o.op==="=="||o.op==="!=")&&(mK(o.left,o.right,o.op,n,t,r),mK(o.right,o.left,o.op,n,t,r)),i(o.left),i(o.right);return}case"unary":i(o.operand);return;case"if":i(o.cond),i(o.then),i(o.else);return;case"call":o.args.forEach(i);return;case"arr":o.items.forEach(i);return;default:return}}s(i,"walk"),i(e)}s(el,"checkGatingExpr");function mK(e,n,t,r,i,o){if(e.kind!=="ident")return;let a=i.get(e.path);if(a){if(a.isConsent&&n.kind==="bool"&&n.value===!1){o.push({severity:"error",path:r,code:"expr.consent-compare-false",message:{de:`Gating-Ausdruck vergleicht die Zustimmung '${e.path}' mit false \u2014 eine Zustimmung ist true oder leer, nie false. '${e.path} != true' verwenden.`,en:`Gating expression compares the consent '${e.path}' to false \u2014 a consent is true or empty, never false. Use '${e.path} != true'.`}});return}a.isBoolean&&(a.hasDefault||n.kind!=="null"&&n.kind==="bool"&&(a.isYesNo&&t==="=="||o.push({severity:"error",path:r,code:"expr.gating-compare-undefaulted-field",message:{de:`Gating-Ausdruck vergleicht das Boolean-Feld '${e.path}' ohne Standardwert per '${t}' mit einem Bool-Literal. In dreiwertiger Logik ist 'undefined ${t} ${n.value}' ${t==="=="?"false":"true"} \u2014 das Gate greift stillschweigend bei ungesetzten Werten. Dem Feld '${e.path}' einen 'defaultValue' geben (oder den Ausdruck umschreiben \u2014 z. B. '${e.path} != null' als ausdr\xFCckliche Gesetzt-Pr\xFCfung).`,en:`Gating expression compares undefaulted boolean field '${e.path}' to a bool literal via '${t}'. In three-valued logic, 'undefined ${t} ${n.value}' is ${t==="=="?"false":"true"} \u2014 the gate fires silently for unset values. Add a 'defaultValue' to field '${e.path}' (or rewrite the expression \u2014 e.g. '${e.path} != null' for an explicit set-check).`}})))}}s(mK,"inspectEqualityOperand");function Cr(e,n,t,r,i){i.push(...AC(e,t.declaredContext,n)),i.push(...mm(e,t.stageKeys,n));for(let o of Ln(e))t.known.has(o)||Kk(o)||r&&o.startsWith("$item.")||i.push({severity:"error",path:n,code:"ref.unknown-ident",message:{de:o.startsWith("$")?`Bezeichner '${o}' ist kein Geltungsbereich, den ein Formular liest \u2014 Umgebungsvariablen sind '$env.<key>.<field>', Wiederholungszeilen '$item.*'.`:`Bezeichner '${o}' ist weder als Feld, berechneter Schl\xFCssel noch als $item-Slot deklariert.`,en:o.startsWith("$")?`Identifier '${o}' is no scope a form reads \u2014 environment variables are '$env.<key>.<field>', repeated rows '$item.*'.`:`Identifier '${o}' is not declared as a field, computed key, or $item slot.`}})}s(Cr,"checkAst");function hK(e,n,t,r){let i=[];e.nameFrom!==void 0&&i.push({severity:"error",path:`${t}.nameFrom`,code:"person.name-from-removed",message:{de:`Effekt '${e.id}': eine Person hat kein nameFrom mehr \u2014 ihr Name ist die Feldzuordnung (fieldMap) auf ${Nr.firstName} / ${Nr.lastName}. nameFrom entfernen.`,en:`Effect '${e.id}': a person has no nameFrom any more \u2014 its name is the fieldMap onto ${Nr.firstName} / ${Nr.lastName}. Remove nameFrom.`}});let o=iK(e.id,n);sK(o)||i.push({severity:"error",path:t,code:"person.without-name-mapping",message:{de:`Effekt '${e.id}': keine Feldzuordnung (fieldMap) auf ${Nr.firstName} oder ${Nr.lastName} \u2014 die Person bek\xE4me keinen Namen.`,en:`Effect '${e.id}': no fieldMap onto ${Nr.firstName} or ${Nr.lastName} \u2014 the person would get no name.`}});for(let a of oK(o))r(a)||i.push({severity:"error",path:t,code:"ref.unknown-name-field",message:{de:`Effekt '${e.id}': der Name wird aus '${a}' gelesen, das kein eingegebenes Feld ist.`,en:`Effect '${e.id}': its name is read from '${a}', which is not an entered field.`}});return i}s(hK,"personNameIssues");function v9(e,n){let t=[],r=e.required===!0||e.requiredIf!==void 0;return e.type==="consent"&&(e.defaultValue!=null&&t.push({severity:"error",path:n,code:"config.consent-default",message:{de:`Feld '${e.key}' ist eine Zustimmung mit einem defaultValue \u2014 zustimmen muss die Familie selbst. Den defaultValue entfernen.`,en:`Field '${e.key}' is a consent with a defaultValue \u2014 the family must give it themselves. Remove the defaultValue.`}}),e.sameAs!==void 0&&t.push({severity:"error",path:n,code:"config.consent-computed",message:{de:`Feld '${e.key}' ist eine Zustimmung, die ein anderes Feld spiegelt (sameAs) \u2014 zustimmen muss die Familie selbst. sameAs entfernen.`,en:`Field '${e.key}' is a consent mirroring another field (sameAs) \u2014 the family must give it themselves. Remove sameAs.`}}),r||t.push({severity:"error",path:n,code:"config.consent-not-required",message:{de:`Feld '${e.key}' ist eine Zustimmung, die nie verlangt wird \u2014 required: true oder requiredIf setzen, sonst Typ 'boolean' verwenden.`,en:`Field '${e.key}' is a consent nobody is asked to give \u2014 set required: true or requiredIf, or use type 'boolean'.`}})),e.type==="boolean"&&r&&e.defaultValue?.trim()==="false"&&t.push({severity:"warning",path:n,code:"config.boolean-required-default-false",message:{de:`Feld '${e.key}' ist ein Ja/Nein-Pflichtfeld, vorbelegt mit Nein \u2014 es gilt von Anfang an als ausgef\xFCllt. Ist es eine Zustimmung, Typ 'consent' verwenden.`,en:`Field '${e.key}' is a required yes/no preset to No \u2014 it counts as answered from the start. If it is a consent, use type 'consent'.`}}),t}s(v9,"consentConfigIssues");function x9(e,n){let t=e.exclusiveOptions;if(t===void 0)return[];let r=s((a,l)=>[{severity:"error",path:n,code:"config.exclusive-options",message:{de:a,en:l}}],"refuse");if(e.type!=="enum"||e.multiple!==!0)return r(`Feld '${e.key}' setzt exclusiveOptions ohne Mehrfachauswahl \u2014 exklusive Optionen gibt es nur bei type: 'enum' mit multiple: true.`,`Field '${e.key}' sets exclusiveOptions without a multi-select \u2014 exclusive options exist only on type: 'enum' with multiple: true.`);if(e.enumListKey!==void 0)return r(`Feld '${e.key}' setzt exclusiveOptions auf einer Liste des Mandanten (enumListKey) \u2014 exklusive Optionen brauchen eigene enumOptions.`,`Field '${e.key}' sets exclusiveOptions on a tenant list (enumListKey) \u2014 exclusive options need inline enumOptions.`);if(!Array.isArray(t)||t.length===0||t.some(a=>typeof a!="string"))return r(`Feld '${e.key}' setzt exclusiveOptions auf ${JSON.stringify(t)} \u2014 erwartet ist eine nicht leere Liste von Optionsschl\xFCsseln.`,`Field '${e.key}' sets exclusiveOptions to ${JSON.stringify(t)} \u2014 it must be a non-empty list of option keys.`);let i=e.enumOptions??[],o=t.filter(a=>!i.includes(a));return o.length>0?r(`Feld '${e.key}' nennt in exclusiveOptions ${o.map(a=>`'${a}'`).join(", ")} \u2014 keine Option des Feldes.`,`Field '${e.key}' names ${o.map(a=>`'${a}'`).join(", ")} in exclusiveOptions \u2014 not an option of the field.`):new Set(t).size!==t.length?r(`Feld '${e.key}' nennt eine Option in exclusiveOptions doppelt.`,`Field '${e.key}' names an option twice in exclusiveOptions.`):[]}s(x9,"exclusiveOptionIssues");var S9="blocked";function kK(e,n){let t={values:n};for(let r of e.outcomes){let i;try{i=kn(r.when,t)}catch(o){F(`resolveActiveOutcome: outcome "${r.id}" when-expression threw: ${o instanceof Error?o.message:String(o)}`,{cause:o})}if(A9(i))return r.id===S9?null:r.id}return null}s(kK,"resolveActiveOutcome");function A9(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(A9,"truthy");function bK(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}s(bK,"isScalar");function E9(e,n,t){for(let[r,i]of Object.entries(e))if(i!==void 0){if(bK(i)){n[r]=i;continue}if(Array.isArray(i)){n[r]=i;continue}for(let[o,a]of Object.entries(i))bK(a)&&(n[`${r}.${o}`]=a)}T9(e,n,t)}s(E9,"mergeRecord");function T9(e,n,t){let r=new Set(t);for(let i of Object.keys(e)){let o=i.indexOf("[");if(o<=0)continue;let a=i.slice(0,o);go(a).test(i)&&r.add(a)}for(let i of r){let o=fS(e,i),a=0;for(let l=0;l<o;l++)Qq(e,i,l)&&a++;n[`${i}.count`]=a}}s(T9,"mergeRepeatedCounts");function vK(e,n,t){let r={...t};return E9(e,r,n),r}s(vK,"flattenValues");function yS(e,n,t){return{code:e,fieldKey:n,text:t}}s(yS,"submitIssue");function xK(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(xK,"truthyEval");function SK(e){if(e==null)return!0;if(typeof e=="string")return e.trim()==="";if(Array.isArray(e))return e.length===0;if(typeof e=="object"){let n=e;if("storageId"in n)return!(typeof n.storageId=="string"&&n.storageId.trim()!=="");let t=n;return!t.street?.trim()||!t.hausnr?.trim()||!t.plz?.trim()||!t.ort?.trim()||!t.land?.trim()}return!1}s(SK,"isEmptyValue");function R9(e,n,t){let r=!!e.required;if(!r&&e.requiredIf)try{r=xK(kn(e.requiredIf,{values:n}))}catch{r=!1}return r?e.requiredFor?t===null?!1:e.requiredFor.includes(t):!0:!1}s(R9,"fieldIsLiveRequired");function $9(e,n,t){return AK(e,n,t).evalCtx}s($9,"buildSubmitEvalContext");function AK(e,n,t){let r=I9(e),i=Object.keys(n).filter(l=>r(l)!==null),o=new Set(i),a=new Set;for(;;){let l={};for(let[y,k]of Object.entries(n))(r(y)===null||o.has(y))&&(l[y]=k);let d=EK(e,l,t),c=new Set,u=new Set;RK(e,d,y=>c.add(y.key),y=>u.add(y.key));let p=new Set(i.filter(y=>{let k=r(y);return k.kind==="field"?c.has(y):u.has(k.repeatedKey)}));if(p.size===o.size&&[...p].every(y=>o.has(y))){let y={};for(let k of i)o.has(k)||(y[k]=n[k]);return{visible:l,hidden:y,evalCtx:d}}let h=[...p].sort().join("\0");if(a.has(h)){let y=i.filter(k=>p.has(k)!==o.has(k));F(`[smartForm] visibility of ${y.join(", ")} does not settle \u2014 each depends on whether the other's value counts. The form's visibleIf conditions are contradictory.`)}a.add(h),o=p}}s(AK,"splitWithContext");function I9(e){let n=new Map,t=[];for(let r of zh(e.sections)){for(let i of r.fields)n.set(i.key,i);for(let i of r.groups??[])for(let o of i.fields)n.set(o.key,o);for(let i of r.repeated??[])t.push({key:i.key,pattern:go(i.key),items:new Map(i.itemTemplate.map(o=>[o.key,o]))})}return r=>{let i=n.get(r);if(i!==void 0)return{kind:"field",field:i};for(let o of t){let a=o.pattern.exec(r);if(a!==null)return{kind:"row",repeatedKey:o.key,field:o.items.get(a[2])}}return null}}s(I9,"fieldOwnership");function EK(e,n,t){let r=[];for(let o of zh(e.sections))for(let a of o.repeated??[])r.push(a.key);let i=vK(n,r,t);for(let o of zh(e.sections))for(let a of o.computed??[])try{i[a.key]=kn(a.expression,{values:i})}catch{}return i}s(EK,"rawEvalContext");function TK(e,n,t){let{values:r,defaulted:i}=O9(e,n,t),o=AK(e,r,t),a={};for(let[l,d]of Object.entries(o.hidden))i.has(l)||(a[l]=d);return{...o,hidden:a}}s(TK,"splitDraftValues");function O9(e,n,t,r){let i={...n},o=new Set,a=null;for(let l of zh(e.sections))for(let d of[...l.fields,...(l.groups??[]).flatMap(c=>c.fields)]){if(!d.defaultValue||n[d.key]!=null||r?.(d.key))continue;a??=EK(e,n,t);let c;try{c=kn(d.defaultValue,{values:a})}catch(u){F(`[smartForm] defaultValue of '${d.key}' does not evaluate: ${u instanceof Error?u.message:String(u)}`)}c!=null&&(i[d.key]=c,o.add(d.key))}return{values:i,defaulted:o}}s(O9,"applyFieldDefaults");function zh(e){let n=[],t=s(r=>{n.push(r);for(let i of r.subsections??[])t(i)},"walk");for(let r of e)t(r);return n}s(zh,"walkSectionsDeep");function _9(e,n,t,r=!1){if(SK(n))return null;let i=t.fields[e.type];i||F(`[fieldFormatIssue] no field provider registered for type "${e.type}" (field "${e.key}"). Register it in the domain form registry.`);let o=i.validate(e,n,{state:{values:{},computed:{}},testMode:r});return o.length>0?o[0].message:null}s(_9,"fieldFormatIssue");function P9(e,n){return SK(n)||e.type==="consent"&&n!==!0}s(P9,"isUnanswered");function Gh(e,n){if(!e)return!0;try{return xK(kn(e,{values:n}))}catch{return!1}}s(Gh,"isVisibleUnder");function RK(e,n,t,r){let i=s(o=>{if(Gh(o.visibleIf,n)){for(let a of o.fields)Gh(a.visibleIf,n)&&t(a);for(let a of o.groups??[])if(Gh(a.visibleIf,n))for(let l of a.fields)Gh(l.visibleIf,n)&&t(l);if(r!==void 0)for(let a of o.repeated??[])r(a);for(let a of o.subsections??[])i(a)}},"walk");for(let o of e.sections)i(o)}s(RK,"forEachVisibleField");function $K(e,n,t,r={}){let i=$9(e,n,t),o=[],a=kK(e,i);a===null&&r.requireOutcome!==!1&&o.push(yS("no-outcome",null,{de:"Die Angaben ergeben keinen g\xFCltigen Abschluss \u2014 bitte pr\xFCfen Sie das Formular.",en:"The answers do not lead to a valid outcome \u2014 please check the form."}));let l=new Set(r.exemptFromRequired??[]);return RK(e,i,d=>{let c=n[d.key];if(P9(d,c)){!l.has(d.type)&&R9(d,i,a)&&o.push(yS("required",d.key,Ul([d.label],([p],h)=>h==="de"?`${p} ist ein Pflichtfeld.`:`${p} is a required field.`)));return}if(!r.registry)return;let u=_9(d,c,r.registry,r.testMode===!0);u!==null&&o.push(yS("format",d.key,u))}),{issues:o,activeOutcome:a,evalCtx:i,submittable:o.length===0}}s($K,"checkSubmittable");function OK(){return[...Be,null].flatMap(n=>fw.map(t=>({language:n,channel:t})))}s(OK,"applicantVariants");function _K(e,n){let t=new Map;for(let r of e){let i={};for(let a of n)r[a]===void 0&&F(`[scenario/environment] the host supplied no "${a}"`),i[a]=r[a];let o=JSON.stringify(n.map(a=>i[a]));t.has(o)||t.set(o,i)}return[...t.values()]}s(_K,"projectEnvironments");var IK={"self-service":{de:"online",en:"online"},staff:{de:"durch die Schule",en:"by the school"}};function PK(e){let n=[];for(let t of[e.offer?.title,e.unit?.name,e.stage?.name,e.run?.name])t!==void 0&&n.push({de:t,en:t});if(e.applicant){let{language:t,channel:r}=e.applicant;n.push({de:`${t===null?"ohne Konto":`Konto ${t}`}, ${IK[r].de}`,en:`${t===null?"no account":`account ${t}`}, ${IK[r].en}`})}return{de:n.map(t=>t.de).join(" \xB7 "),en:n.map(t=>t.en).join(" \xB7 ")}}s(PK,"describeEnvironment");var NK=6;function CK(e,n){let t=e.slice(0,NK).map(i=>i[n]).join("; "),r=e.length-NK;return r<=0?t:n==="de"?`${t} und ${r} weitere`:`${t} and ${r} more`}s(CK,"listed");function DK(e,n){let t=e.testScenarios??[];if(t.length===0)return[];let r=SC(e).filter(Ji),i=r.length===0?[{}]:n??[];if(r.length>0&&n===void 0)return[{severity:"warning",path:"testScenarios",code:"scenario.unjudged",message:{de:`Die Testszenarien werden hier nicht gepr\xFCft: das Formular liest ${r.join(", ")}, und welche Klassenstufen und Schuljahre das Angebot hat, ist hier nicht bekannt \u2014 die Ver\xF6ffentlichung pr\xFCft sie.`,en:`The test scenarios are not judged here: the form reads ${r.join(", ")}, and which grades and school years the offer has is not known here \u2014 publishing judges them.`}}];if(i.length===0)return[{severity:"warning",path:"testScenarios",code:"scenario.no-environment",message:{de:"Das Angebot hat noch keine Klassenstufe mit Schuljahr \u2014 die Testszenarien sind gegen keine Umgebung gepr\xFCft. Nach dem Anlegen erneut ver\xF6ffentlichen.",en:"The offer has no grade with a school year yet \u2014 the test scenarios are judged against no environment. Publish again once one exists."}}];let{compiled:o}=$a(e),a=[];for(let l of t){let d=l.prefill??{},c=new Map,u=s((p,h)=>{let y=`${p.path}\0${p.message.de}`,k=c.get(y);k===void 0?c.set(y,{...p,where:[h]}):k.where.some(w=>w.de===h.de)||k.where.push(h)},"add");for(let p of i){let h=xC(p,r),{visible:y}=TK(o,d,h),k=$K(o,y,h,{exemptFromRequired:["docRef"]}),w=PK(p);for(let b of k.issues){if(b.code==="no-outcome"){u({path:`scenario:${l.id}`,code:"scenario.no-outcome",message:{de:`Szenario "${l.label.de}" erreicht kein g\xFCltiges Outcome \u2013 der Testfall ist nicht absendbar.`,en:`Scenario "${l.label.en}" reaches no valid outcome \u2013 the test case cannot be submitted.`}},w);continue}if(b.code==="required"){u({path:`scenario:${l.id}/${b.fieldKey}`,code:"scenario.required-field-unfilled",message:{de:`Szenario "${l.label.de}" l\xE4sst das Pflichtfeld ${b.fieldKey} unbef\xFCllt \u2013 kein g\xFCltiges Outcome.`,en:`Scenario "${l.label.en}" leaves the required field ${b.fieldKey} empty \u2013 no valid outcome.`}},w);continue}u({path:`scenario:${l.id}/${b.fieldKey}`,code:"scenario.invalid-value",message:Ul([l.label,b.text],([T,E],$)=>$==="de"?`Szenario "${T}": ${E}`:`Scenario "${T}": ${E}`)},w)}}for(let p of c.values())a.push({severity:"error",path:p.path,code:p.code,message:r.length===0?p.message:{de:`${p.message.de} \u2014 in: ${CK(p.where,"de")}`,en:`${p.message.en} \u2014 in: ${CK(p.where,"en")}`}})}return a}s(DK,"validateScenarios");function Wh(e){return e.filter(n=>(n.severity??"error")==="error")}s(Wh,"blockingIssues");function Yh(e,n={}){return[...gK(e,n),...DK(e,n.scenarioEnvironments)]}s(Yh,"runFormValidators");function Hh(e){return Wh(e)}s(Hh,"blockingFormErrors");function FK(e,n,t){return FD(e,n,t)}s(FK,"runWorkflowValidators");function LK(e){return Wh(e)}s(LK,"blockingWorkflowErrors");var N9=["actionTeams","artifacts","assign","inputs","library","next","notifications","optionalActions","outcomes","outputLabels","sublabel","tasks"];var MK={join:{required:[],optional:[]},end:{required:[],optional:[]},eventTrigger:{required:[],optional:[]},form:{required:[],optional:["adoptForm","formExports"]},roleAssign:{required:[],optional:[]},setFlag:{required:[],optional:[]},if:{required:["condition"],optional:[]},countersign:{required:["contract"],optional:["signing","titles"]},engagePush:{required:["form"],optional:["contract","engage","payment"]},decision:{required:[],optional:["commentRequired","decisionAsTask","reads","requiresOneOf","view"]},review:{required:[],optional:["commentRequired","decisionAsTask","form"]},waitlist:{required:[],optional:[]},completenessCheck:{required:["deadline","requires"],optional:[]},collectPayment:{required:[],optional:[]},governedDocument:{required:["approval","production","responseStrategy"],optional:["confirmBeforeIssue","confirmContractTerms","contractTermsQuestionText","form","generatorStamp","reads","responseLabels","templateStamp","titles"]}},St={id:m.string(),label:$i,actionTeams:m.optional(m.any()),artifacts:m.optional(m.any()),assign:m.optional(m.any()),inputs:m.optional(m.any()),library:m.optional(m.any()),next:m.optional(m.any()),notifications:m.optional(m.any()),optionalActions:m.optional(m.any()),outcomes:m.optional(m.any()),outputLabels:m.optional(m.any()),sublabel:m.optional(m.any()),tasks:m.optional(m.any())},C9=m.object({...St,type:m.literal("join")}),D9=m.object({...St,type:m.literal("end")}),F9=m.object({...St,type:m.literal("eventTrigger")}),L9=m.object({...St,type:m.literal("form"),adoptForm:m.optional(m.any()),formExports:m.optional(m.any())}),M9=m.object({...St,type:m.literal("roleAssign")}),q9=m.object({...St,type:m.literal("setFlag")}),K9=m.object({...St,type:m.literal("if"),condition:m.optional(m.any())}),j9=m.object({...St,type:m.literal("countersign"),contract:m.optional(m.any()),signing:m.optional(m.any()),titles:m.optional(m.any())}),V9=m.object({...St,type:m.literal("engagePush"),contract:m.optional(m.any()),engage:m.optional(m.any()),form:m.optional(m.any()),payment:m.optional(m.any())}),B9=m.object({...St,type:m.literal("decision"),commentRequired:m.optional(m.any()),decisionAsTask:m.optional(m.any()),reads:m.optional(m.any()),requiresOneOf:m.optional(m.any()),view:m.optional(m.any()),formView:m.optional(m.any())}),U9=m.object({...St,type:m.literal("review"),commentRequired:m.optional(m.any()),decisionAsTask:m.optional(m.any()),form:m.optional(m.any())}),G9=m.object({...St,type:m.literal("waitlist")}),z9=m.object({...St,type:m.literal("completenessCheck"),deadline:m.optional(m.any()),requires:m.optional(m.any())}),W9=m.object({...St,type:m.literal("collectPayment")}),Y9=m.object({...St,type:m.literal("governedDocument"),approval:m.optional(m.any()),confirmBeforeIssue:m.optional(m.any()),confirmContractTerms:m.optional(m.any()),contractTermsQuestionText:m.optional(m.any()),form:m.optional(m.any()),generatorStamp:m.optional(m.any()),production:m.optional(m.any()),reads:m.optional(m.any()),responseLabels:m.optional(m.any()),responseStrategy:m.optional(m.any()),templateStamp:m.optional(m.any()),titles:m.optional(m.any())}),Aje=m.union(C9,D9,F9,L9,M9,q9,K9,j9,V9,B9,U9,G9,z9,W9,Y9);function qK(e){let n=[];return e.forEach((t,r)=>{if(t===null||typeof t!="object"||Array.isArray(t)){n.push(`graph.nodes[${r}]: a node must be an object`);return}let i=t,o=`graph.nodes[${r}]${typeof i.id=="string"?` (${i.id})`:""}`;(typeof i.id!="string"||i.id==="")&&n.push(`${o}: \`id\` must be a non-empty string`);let a=i.type;if(typeof a!="string"||!(a in MK)){n.push(`${o}: unknown node type ${JSON.stringify(a)}`);return}let l=MK[a],d=new Set(["id","type","label",...N9,...l.required,...l.optional]);for(let c of Object.keys(i))d.has(c)||n.push(`${o}: \`${c}\` is not a field of a ${a} node. Delete the line.`)}),n}s(qK,"workflowNodeEnvelopeIssues");var KK=s(e=>e,"asEffectId"),yo=s(e=>e,"asOutcomeId"),nl=s(e=>e,"asSectionId"),pt=s(e=>e,"asFieldKey");var Dr=["string","boolean","consent","date","enum","email","tel","address","docRef"],wc=["person","organization","relationship","fieldMap"],wo=["auto-on-any-write","auto-on-required-complete","workflow-explicit"],tl=["fresh","keyed","manual"];function ws(e,n,t,r){if(e===void 0||e===""){if(n!==void 0&&n!=="")throw new Error(`${t}: ${r}-en needs ${r} too`);return}return dn(e,n,t,r)}s(ws,"optionalLocalizedText");function tt(e,n){if(!(e===void 0||e===""))try{Fn(e)}catch(t){throw new Error(`offer form: ${n} is not a valid expression: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}s(tt,"assertExpression");function kc(e){return Object.keys(e.smartforms??{})}s(kc,"carriedFormSlugs");function wS(e){let t=e.workflow?.graph?.nodes??[],r=[];for(let i of t){if(i.type!=="form")continue;let o=i.inputs?.smartForm;o?.kind==="literal"&&typeof o.value=="string"&&o.value&&r.push(o.value)}return r}s(wS,"boundFormSlugs");function Jh(e,n){let t=kc(e);if(n){if(!t.includes(n))throw new Error(`offer form: no smartform "${n}" in this bundle (have: ${t.join(", ")||"none"})`);return n}if(t.length===0)throw new Error("offer form: bundle carries no smartforms \u2014 run `offer form add` first");if(t.length>1)throw new Error(`offer form: bundle carries ${t.length} smartforms \u2014 pass --form <key> (one of: ${t.join(", ")})`);return t[0]}s(Jh,"resolveFormSlug");function Qh(e,n){let t=e.smartforms?.[n];if(!t)throw new Error(`offer form: smartform "${n}" not found in bundle`);return t}s(Qh,"getForm");function Jt(e){let n=[],t=s(r=>{n.push(r),r.subsections?.forEach(i=>t(i))},"visit");return e.sections.forEach(t),n}s(Jt,"walkSections");function pr(e,n){return Jt(e).find(t=>t.id===n)}s(pr,"findSection");function ks(e,n){for(let t of Jt(e)){let r=t.fields.findIndex(i=>i.key===n);if(r>=0)return{section:t,field:t.fields[r],index:r}}}s(ks,"findField");function bs(e){let n=new Set;for(let t of Jt(e))t.fields.forEach(r=>n.add(r.key)),t.groups?.forEach(r=>r.fields.forEach(i=>n.add(i.key))),t.repeated?.forEach(r=>r.itemTemplate.forEach(i=>n.add(i.key))),t.computed?.forEach(r=>n.add(r.key));return n}s(bs,"allFieldKeys");function H9(e){let n=dn(e.label,e.labelEn,"offer form add"),t={id:nl("section.allgemein"),label:{de:"Allgemein",en:"General"},fields:[]},r={id:yo("standard"),label:{de:"Standard",en:"Standard"},when:"true",output:{includeForm:!0}};return{label:n,sections:[t],effects:[],outcomes:[r]}}s(H9,"buildSkeletonSmartForm");function Zh(e,n){let{key:t,label:r}=n;if(kc(e).includes(t))throw new Error(`offer form add: smartform "${t}" already exists in this bundle`);let i=H9({key:t,label:r,...n.labelEn?{labelEn:n.labelEn}:{}});e.smartforms={...e.smartforms??{},[t]:i},e.index.smartforms={...e.index.smartforms??{},[t]:{}}}s(Zh,"addForm");function jK(e,n){if(!kc(e).includes(n))throw new Error(`offer form rm: smartform "${n}" not found in bundle`);if(wS(e).includes(n))throw new Error(`offer form rm: smartform "${n}" is still bound by a form node \u2014 remove the form node first (offer workflow node rm), then the form`);return delete e.smartforms[n],e.index.smartforms&&delete e.index.smartforms[n],n}s(jK,"removeForm");function VK(e,n){let t=Qh(e,n.slug);if(n.label===void 0&&n.labelEn===void 0)throw new Error("offer form set: nothing to change \u2014 pass --label/--label-en");if(n.label==="")throw new Error("offer form set: --label cannot be empty");vn(t,"label",{de:n.label,en:n.labelEn},"offer form set")}s(VK,"setForm");function BK(e,n){let t=e.workflow?.graph?.nodes;if(!Array.isArray(t))throw new Error(`${n}: the bundle carries no workflow graph (workflow.json)`);return t}s(BK,"nodesOf");function UK(e,n,t){let r=BK(e,t),i=r.find(o=>o.id===n);if(i===void 0)throw new Error(`${t}: no node "${n}" (nodes: ${r.map(o=>o.id).join(", ")})`);return i}s(UK,"nodeOf");function GK(e){return e.flatMap(n=>{if(n.type!=="form"||Ot(n))return[];let t=n.inputs?.smartForm;return t?.kind==="literal"&&typeof t.value=="string"&&t.value!==""?[{node:n,slug:t.value}]:[]})}s(GK,"creatingFormNodes");function zK(e){return Hh(Yh(e)).map(n=>`[${n.code??"form"}] ${n.path?`${n.path}: `:""}${n.message.de}`)}s(zK,"formErrors");function Xh(e){let n="offer workflow restamp-exports",t=BK(e,n),r=[];for(let{node:i,slug:o}of GK(t)){let a=e.smartforms?.[o];if(a===void 0)throw new Error(`${n}: form node "${i.id}" binds smartForm "${o}", but the bundle carries no smartforms/${o}.json`);let l=a,d=zK(l);if(d.length>0)throw new Error(`${n}: smartform "${o}" is refused by the publish gate \u2014 fix it first:
|
|
11682
|
+
`)}return this.print(r,i=>i.slots.map(o=>{let a=i.override?.[o.key];return{block:o.key,label:o.label,deviates:a===void 0?"":"yes",text:(a??o.default).replace(/\s+/g," ").slice(0,80)}}),["block","label","deviates","text"]),0}},wx=class extends N{static{s(this,"NotificationsLettersSetCommand")}static paths=[["notifications","letters","set"]];static usage=R.Usage({category:"Notifications",description:"Reword one or more blocks of a letter for this school (merge \u2014 untouched blocks stay as they are).",details:"A block whose text EQUALS the platform default is dropped rather than stored: what is kept is the deviation, never a copy, so a later improvement to an untouched block still reaches this school. An unknown block or an undeclared {{placeholder}} is refused by the backend with every finding named \u2014 nothing is written.",examples:[["One paragraph",'$0 --tenant test notifications letters set applicant.welcome --locale de --slot intro="Sch\xF6n, dass Sie da sind."'],["The English letter",'$0 --tenant test notifications letters set applicant.welcome --locale en --slot intro="Lovely to have you."'],["From a file","$0 --tenant test notifications letters set applicant.tasksOpen --locale de --slot-file intro=./intro.txt"]]});templateId=f.String({required:!0});locale=f.String("--locale",{description:`Letter language (${Be.join("|")}) \u2014 required; each language is worded on its own`});slot=f.Array("--slot",{description:"<blockKey>=<text> (repeatable)"});slotFile=f.Array("--slot-file",{description:"<blockKey>=<path> \u2014 read the text from a local file (repeatable)"});async execute(){let n=g8(this.slot,this.slotFile);if(Object.keys(n).length===0)throw new Error("notifications letters set: nothing to write \u2014 pass --slot <blockKey>=<text> or --slot-file <blockKey>=<path>");let t=await this.caller(),r=await t.mutation(x.notifications.saveLetterOverride,{tenantSlug:this.requireTenant(t),templateId:this.templateId,locale:xx(this.locale,"letters set"),slots:n});return this.print({templateId:this.templateId,submitted:Object.keys(n),...r},i=>[{key:"letter",value:i.templateId},{key:"submitted",value:i.submitted.join(", ")},{key:"deviating blocks",value:i.overriddenSlotKeys.join(", ")||"\u2014 (back to the platform text)"}]),0}},kx=class extends N{static{s(this,"NotificationsLettersResetCommand")}static paths=[["notifications","letters","reset"]];static usage=R.Usage({category:"Notifications",description:"Drop this school's deviations \u2014 named blocks, or the whole letter with --all.",details:"--all is required to drop a whole letter: dropping everything must be typed, never be what happens when a --slot is forgotten.",examples:[["One block back to the platform text","$0 --tenant test notifications letters reset applicant.welcome --locale de --slot intro"],["The whole letter","$0 --tenant test notifications letters reset applicant.welcome --locale en --all"]]});templateId=f.String({required:!0});locale=f.String("--locale",{description:`Letter language (${Be.join("|")}) \u2014 required; each language is worded on its own`});slot=f.Array("--slot",{description:"Block key to reset (repeatable)"});all=f.Boolean("--all",!1,{description:"Reset every block of this letter"});async execute(){let n=(this.slot??[]).map(i=>i.trim()).filter(Boolean);if(this.all&&n.length>0)throw new Error("notifications letters reset: --all resets everything \u2014 it cannot be combined with --slot.");if(!this.all&&n.length===0)throw new Error("notifications letters reset: name the blocks with --slot <blockKey>, or pass --all to reset the whole letter.");let t=await this.caller(),r=await t.mutation(x.notifications.resetLetterOverride,{tenantSlug:this.requireTenant(t),templateId:this.templateId,locale:xx(this.locale,"letters reset"),...this.all?{}:{slotKeys:n}});return this.print({templateId:this.templateId,reset:this.all?"all":n.join(", "),...r},i=>[{key:"letter",value:i.templateId},{key:"reset",value:i.reset},{key:"still deviating",value:i.overriddenSlotKeys.join(", ")||"\u2014 (nothing)"}]),0}},pc=s((e,n)=>e==null?n:e.replace(/\s*\n\s*/g," \u23CE "),"flatCell");function vh(e,n,t){return["de","en"].map(r=>({field:`${e} (${r})`,school:n===null?"\u2014 (platform)":n[r]===""?"\u2014 (untranslated)":pc(n[r],""),...t===null?{}:{platform:pc(t[r],"")}}))}s(vh,"chromeTextRows");var bx=class extends N{static{s(this,"NotificationsChromeShowCommand")}static paths=[["notifications","chrome","show"]];static usage=R.Usage({category:"Notifications",description:"The school's letter frame (greeting and sign-off per language, sender name) and the platform wording each falls back to."});async execute(){let n=await this.caller(),t=await n.query(x.notifications.getTenantChrome,{tenantSlug:this.requireTenant(n)});return this.print(t,r=>[...vh("greeting",r.greeting,r.defaults.greeting),...vh("closing",r.closing,r.defaults.closing),{field:"senderName",school:pc(r.senderName,"\u2014 (platform)"),platform:pc(r.defaults.senderName,"")}],["field","school","platform"]),0}},vx=class extends N{static{s(this,"NotificationsChromeSetCommand")}static paths=[["notifications","chrome","set"]];static usage=R.Usage({category:"Notifications",description:"Set the school's letter frame. Greeting and sign-off are set in BOTH languages at once; both EMPTY clears that field back to the platform wording.",examples:[["Own sign-off",'$0 --tenant test notifications chrome set --closing-de="Herzliche Gr\xFC\xDFe, Ihr Grundschul-Team" --closing-en="Warm regards, your primary school team"'],["Back to the platform sign-off",'$0 --tenant test notifications chrome set --closing-de="" --closing-en=""']]});greetingDe=f.String("--greeting-de",{description:"Opening line, German"});greetingEn=f.String("--greeting-en",{description:"Opening line, English"});closingDe=f.String("--closing-de",{description:"Sign-off, German"});closingEn=f.String("--closing-en",{description:"Sign-off, English"});senderName=f.String("--sender-name",{description:"Name the school signs with (empty string clears it)"});async execute(){let n=s((l,d,c)=>{if(!(d===void 0&&c===void 0)){if(d===void 0||c===void 0)throw new Error(`notifications chrome set: --${l}-de and --${l}-en go together \u2014 the frame is worded in every language`);return{de:d,en:c}}},"pair"),t=n("greeting",this.greetingDe,this.greetingEn),r=n("closing",this.closingDe,this.closingEn);if(t===void 0&&r===void 0&&this.senderName===void 0)throw new Error("notifications chrome set: nothing to change \u2014 pass --greeting-de/--greeting-en, --closing-de/--closing-en or --sender-name");let i=await this.caller(),o=this.requireTenant(i);await i.mutation(x.notifications.saveTenantChrome,{tenantSlug:o,...t!==void 0?{greeting:t}:{},...r!==void 0?{closing:r}:{},...this.senderName!==void 0?{senderName:this.senderName}:{}});let a=await i.query(x.notifications.getTenantChrome,{tenantSlug:o});return this.print(a,l=>[...vh("greeting",l.greeting,null),...vh("closing",l.closing,null),{field:"senderName",school:pc(l.senderName,"\u2014 (platform)")}],["field","school"]),0}},Q0=[ux,fx,px,mx,hx,gx,yx,wx,kx,bx,vx];var w8={capacity:null,isOpen:!1},k8={capacity:null,isOpen:!0};function b8(e){return e===null||e==="unlimited"||typeof e=="number"&&Number.isInteger(e)&&e>=0}s(b8,"isCapacity");function xh(e,n){let t=[],r=n===void 0?void 0:new Set(n);return e.forEach((i,o)=>{if(i.capacities===void 0)return;let a=`program.runs[${o}] ("${i.key}")`;if(i.isOpen!==void 0&&t.push(`[capacity/runIsOpenWithCells] ${a}: \`isOpen\` on the run AND \`capacities\` \u2014 the open state lives on each cell; drop the run-level \`isOpen\``),i.capacities===null||typeof i.capacities!="object"||Array.isArray(i.capacities)){t.push(`[capacity/shape] ${a}: \`capacities\` must map stage keys to { isOpen, capacity }`);return}for(let[l,d]of Object.entries(i.capacities)){let c=`${a}.capacities.${l}`;r!==void 0&&!r.has(l)&&t.push(`[capacity/unknownStage] ${c}: no stage with key "${l}" in program.stages (have: ${[...r].join(", ")||"none"})`);let u=d;if(u===null||typeof u!="object"){t.push(`[capacity/shape] ${c}: expected { isOpen, capacity }`);continue}typeof u.isOpen!="boolean"&&t.push(`[capacity/isOpen] ${c}: \`isOpen\` must be true or false`),(!("capacity"in u)||!b8(u.capacity))&&t.push(`[capacity/value] ${c}: \`capacity\` must be a whole number \u2265 0, "unlimited", or null (unconfigured) \u2014 got ${JSON.stringify(u.capacity)}`)}}),t}s(xh,"capacitySpecIssues");function X0(e,n,t={stageKeys:[],runKeys:[]}){let r=e.programKey,i=new Map;if(r!==null)for(let c of e.stages)c.archived||i.set(Jr(r,c.key),c.stageId);let o=new Set(t.stageKeys),a=new Set(t.runKeys),l=new Map(e.runStages.map(c=>[`${c.runId}|${c.stageId}`,c])),d=[];for(let c of n){if(c.capacities===void 0)continue;let u=r===null?void 0:e.runs.find(p=>p.key===nr(r,c.key));if(u===void 0&&!a.has(c.key))throw new Error(`offer[admission]: run "${c.key}" does not exist and is not created by this apply`);for(let[p,h]of Object.entries(c.capacities)){let y=i.get(p);if(y===void 0&&!o.has(p))throw new Error(`offer[admission]: capacities of run "${c.key}" name stage "${p}", which the program does not have (have: ${[...i.keys()].join(", ")||"none"})`);let k={capacity:h.capacity,isOpen:h.isOpen},w=u!==void 0&&y!==void 0?l.get(`${u.runId}|${y}`):void 0,b=w!==void 0?{capacity:w.capacity,isOpen:w.isOpen}:u===void 0?w8:k8;b.capacity===k.capacity&&b.isOpen===k.isOpen||d.push({run:c.key,stageKey:p,from:b,to:k})}}return d}s(X0,"planRunCapacities");function Z0(e){return`${e.capacity===null?"unconfigured":String(e.capacity)}/${e.isOpen?"open":"closed"}`}s(Z0,"describeCell");function Sh(e){return`~cap ${e.run}\xD7${e.stageKey} ${Z0(e.from)} \u2192 ${Z0(e.to)}`}s(Sh,"describeCapacityStep");function eM(e){if(e.programKey===void 0)throw new Error("offer[admission]: the target backend predates stage keys \u2014 deploy it before running offer plan / apply / export with this CLI")}s(eM,"assertBackendHasStageKeys");async function Sx(e,n,t,r){let i=await e.query(x.programAdmin.getAngebotConfig,{client:n,offerKey:t,includeArchived:!0}),o=i.stages.map(u=>({stageId:u.stageId,key:u.key,name:u.name,...u.gradeLevel!==void 0?{gradeLevel:u.gradeLevel}:{},sequence:u.sequence,archived:u.archived}));eM(i);let a=rp(i.programKey,o,r),l=a.flatMap(u=>u.op==="archive"?[u.stageId]:[]);if(l.length===0)return a;let d=await e.query(x.programAdmin.getStageOccupancy,{client:n,offerKey:t,stageIds:l}),c=new Map(d.map(u=>[u.stageId,u]));return a.map(u=>{if(u.op!=="archive")return u;let p=c.get(u.stageId);if(p===void 0)throw new Error(`offer[admission]: no occupancy returned for stage ${u.stageId}`);return{...u,occupancy:{activeApplications:p.activeApplications,openLeads:p.openLeads}}})}s(Sx,"planStages");async function Ah(e,n,t,r){let i=r.program?.runs??[];if(!i.some(c=>c.capacities!==void 0))return[];let o=t===null?{programKey:null,stages:[],runs:[],runStages:[]}:await e.query(x.programAdmin.getAngebotConfig,{client:n,offerKey:t});eM(o);let a=new Set(o.programKey===null?[]:o.stages.map(c=>Jr(o.programKey,c.key))),l=r.program?.stages?.map(c=>c.key)??[],d=o.programKey;return X0(o,i,{stageKeys:l.filter(c=>!a.has(c)),runKeys:i.map(c=>c.key).filter(c=>d===null||!o.runs.some(u=>u.key===nr(d,c)))})}s(Ah,"planCapacities");async function v8(e,n,t,r){let i=(r.program?.runs??[]).map(d=>d.key);if(i.length===0)return;let o=await e.query(x.programAdmin.getAngebotConfig,{client:n,offerKey:t,includeArchived:!0}),a=o.programKey;if(a===null)return;let l=i.filter(d=>o.runs.some(c=>c.key===nr(a,d)&&c.status==="archived"));if(l.length>0)throw new Error(`offer[admission]: run(s) ${l.map(d=>`"${d}"`).join(", ")} exist only ARCHIVED \u2014 restore with \`offer run restore --run <key>\` or drop the bundle entry`)}s(v8,"assertNoArchivedRunKey");var Ax={name:"admission",async scaffold(e,n,t,r){let i=t.tenant,o=t.program?.stages,a=[...tp(o??[]),...np(t.program?.runs??[])];if(a.length>0)throw new Error(`offer[admission]: ${a.map(w=>w.message.de).join("; ")}`);let l=xh(t.program?.runs??[],o?.map(w=>w.key));if(l.length>0)throw new Error(`offer[admission]: ${l.join("; ")}`);await v8(e,i,n,t);let d=await Ah(e,i,n,t),c=await e.query(x.programAdmin.getAngebotConfig,{client:i,offerKey:n}),u=x8(t);if(!u)throw new Error("offer[admission]: no unit to link \u2014 set links.unitKey or program.unitKey in bundle.yaml");let p=c.units.find(w=>w.key===u);if(!p)throw new Error(`offer[admission]: unit "${u}" not found in tenant "${i}". Available keys: ${c.units.flatMap(w=>w.key===null?[]:[w.key]).join(", ")||"(none)"}`);let h=[];if(r.dryRun||(await e.mutation(x.programAdmin.ensurePedagogyUnit,{client:i,unitId:p.unitId}),await e.mutation(x.programAdmin.createProgramForAngebot,{client:i,offerKey:n,unitId:p.unitId,...t.program?.key!==void 0?{programKey:t.program.key}:{}})),h.push(`unit=${u}`),o!==void 0)if(r.dryRun){let w=await Sx(e,i,n,o);h.push(...w.map(ip))}else{let w=await e.mutation(x.programAdmin.reconcileProgramStages,{client:i,offerKey:n,stages:o.map(b=>({key:b.key,name:b.name,...b.gradeLevel!==void 0?{gradeLevel:b.gradeLevel}:{}}))});h.push(...w.steps,...w.warnings.map(b=>`warning ${b}`))}let y=r.dryRun?c:await e.query(x.programAdmin.getAngebotConfig,{client:i,offerKey:n});for(let w of t.program?.runs??[]){let b=y.programKey===null?void 0:y.runs.find(T=>T.key===nr(y.programKey,w.key));if(b!==void 0){zs(b.name,w.name)||(r.dryRun||await e.mutation(x.programAdmin.updateProgramRun,{client:i,offerKey:n,runId:b.runId,name:w.name}),h.push(`~run ${w.key} ("${Ce(b.name)}" \u2192 "${Ce(w.name)}")`));continue}r.dryRun||await e.mutation(x.programAdmin.addProgramRun,{client:i,offerKey:n,key:w.key,name:w.name,isOpen:w.capacities!==void 0?!1:w.isOpen??!0,...w.startDate?{startDate:w.startDate}:{},...w.endDate?{endDate:w.endDate}:{}}),h.push(`+run ${w.key} (${Ce(w.name)})`)}let k=r.dryRun?d:await Ah(e,i,n,t);if(!r.dryRun&&k.length>0){let w=await e.query(x.programAdmin.getAngebotConfig,{client:i,offerKey:n}),b=w.programKey;if(b===null)throw new Error("offer[admission]: capacities need a program \u2014 none was linked");for(let T of k){let E=w.runs.find(C=>C.key===nr(b,T.run))?.runId,$=w.stages.find(C=>Jr(b,C.key)===T.stageKey)?.stageId;if(E===void 0||$===void 0)throw new Error(`offer[admission]: cell ${T.run}\xD7${T.stageKey} vanished between plan and write`);await e.mutation(x.programAdmin.setRunStageCapacity,{client:i,offerKey:n,runId:E,stageId:$,capacity:T.to.capacity,isOpen:T.to.isOpen})}}return h.push(...k.map(Sh)),h.join(", ")}};function x8(e){let n=e.program?.unitKey,t=e.links?.unitKey;if(n!==void 0&&t!==void 0&&n!==t)throw new Error(`offer[admission]: bundle.yaml names two units \u2014 program.unitKey "${n}" and links.unitKey "${t}"; keep one`);return n??t}s(x8,"bundleUnitKey");var nM={role:"control",effect:"pure",cardinality:"N-to-1"};var Eh=["add","remove","replace"];function tM(e,n){let t=e.inputs?.[n];if(!(!t||t.kind!=="literal"))return t.value!=null?String(t.value):void 0}s(tM,"roleAssignLiteral");var rM={role:"method",effect:"context-mutation",inputs:s(()=>[{id:"person",label:{de:"Person",en:"Person"},type:"personRef",required:!0},{id:"roleKey",label:{de:"Rolle",en:"Role"},type:"roleKey",required:!0,optionSource:"tenantRoles"},{id:"mode",label:{de:"Modus",en:"Mode"},type:"enum",defaultValue:"add",optionSource:"declared",enumOptions:[{value:"add",label:{de:"Rolle hinzuf\xFCgen",en:"Add role"}},{value:"remove",label:{de:"Rolle entziehen",en:"Remove role"}},{value:"replace",label:{de:"Alle Rollen ersetzen",en:"Replace all roles"}}]}],"inputs"),validate:s((e,n,t)=>{let r=[],i=tM(e,"roleKey")?.trim()??"",o=tM(e,"mode")??"add";return i===""?r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.roleKey`,reason:{de:`[roleAssign/missingRoleKey] roleAssign-Knoten "${e.id}" nennt keine Rolle \u2014 welche Rolle vergeben wird, muss der Autor aus dem Rollenkatalog des Mandanten w\xE4hlen.`,en:`[roleAssign/missingRoleKey] roleAssign node "${e.id}" names no role \u2014 the author must choose which role is assigned from the school's role catalog.`},severity:"error"}):t?.roleKeys!==void 0&&!t.roleKeys.has(i)?r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.roleKey`,reason:{de:`[roleAssign/unknownRoleKey] Rolle "${i}" existiert nicht im Rollenkatalog des Mandanten \u2014 der Knoten w\xFCrde bei jeder Ausf\xFChrung abbrechen. Bekannte Rollen: ${[...t.roleKeys].sort().join(", ")}.`,en:`[roleAssign/unknownRoleKey] Role "${i}" does not exist in the school's role catalog \u2014 the node would abort on every run. Known roles: ${[...t.roleKeys].sort().join(", ")}.`},severity:"error"}):t?.assignableRoleKeys!==void 0&&!t.assignableRoleKeys.has(i)&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.roleKey`,reason:{de:`[roleAssign/nonLeafRoleKey] Rolle "${i}" hat untergeordnete Rollen und ist deshalb nicht vergebbar \u2014 eine Partei bekommt ein Blatt, keine Oberkategorie. Vergebbare Rollen: ${[...t.assignableRoleKeys].sort().join(", ")}.`,en:`[roleAssign/nonLeafRoleKey] Role "${i}" has sub-roles and therefore cannot be assigned \u2014 a party gets a leaf role, not a parent category. Assignable roles: ${[...t.assignableRoleKeys].sort().join(", ")}.`},severity:"error"}),Eh.includes(o)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.mode`,reason:{de:`[roleAssign/unknownMode] roleAssign-Knoten "${e.id}" deklariert Modus "${o}" \u2014 erlaubt sind ${Eh.join(" | ")}.`,en:`[roleAssign/unknownMode] roleAssign node "${e.id}" declares mode "${o}" \u2014 allowed are ${Eh.join(" | ")}.`},severity:"error"}),r},"validate")};var S8=["event","effect","outcomes"],Ex=s((e,n,t)=>({layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:n,en:t},severity:"error"}),"issue"),iM={outcomes:[{id:Tr,label:{de:"Gestartet",en:"Started"}}],validate:s((e,n)=>{let t=[],r=e;for(let i of S8)i in r&&t.push(Ex(`nodes.${e.id}.${i}`,`[graph/retiredField] Start-Knoten "${e.id}": \`${i}\` gibt es nicht mehr \u2014 der Knotentyp deklariert seinen einen Ausgang \u201E${Tr}" selbst.`,`[graph/retiredField] Start node "${e.id}": \`${i}\` no longer exists \u2014 the node type declares its one outcome "${Tr}" itself.`));return sr(n.nodes).some(i=>i.target===e.id)&&t.push(Ex(`nodes.${e.id}`,`[eventTrigger/notStart] Knoten "${e.id}" ist ein Start-Knoten, hat aber eine eingehende Kante \u2014 nur der Start l\xF6st ihn aus, jeder Vorgang bliebe hier stehen.`,`[eventTrigger/notStart] Node "${e.id}" is a start node but has an incoming edge \u2014 only the start triggers it, every process would stop here.`)),e.next?.[Tr]===void 0&&t.push(Ex(`nodes.${e.id}.next.${Tr}`,`[eventTrigger/unroutedStart] Start-Knoten "${e.id}" leitet \u201E${Tr}" nirgendwohin.`,`[eventTrigger/unroutedStart] Start node "${e.id}" routes "${Tr}" nowhere.`)),t},"validate")};var A8="submit",oM=[{id:A8,kind:"advance",label:{de:"Absenden",en:"Submit"},availableIn:["draft"]}];function sM(e){return e==="draft"}s(sM,"isWritableSmartFormState");var Tx=["draft","committed"],xNe=Tx.filter(e=>sM(e));async function aM(e,n,t){let r=await e.db.query("smart_form_instances").withIndex("by_applicationId_and_formNodeId",i=>i.eq("applicationId",n).eq("formNodeId",t)).take(2);return r.length>1&&F(`application ${n}: two form instances for node "${t}" (${r[0]._id}, ${r[1]._id}) \u2014 at most one may exist`),r[0]??null}s(aM,"getSmartFormInstance");var lM="form:fill",Rx="request:collectPayment",$x="request:collectPaymentSeparate",si="confirmPayment";var E8={key:lM,recipient:"external",title:{de:"Bewerbung ausf\xFCllen & absenden",en:"Complete & submit application"},unlocks:["submit"],advancesNode:!0},dM={key:"bearbeitung",label:te("In Bearbeitung","In progress"),scope:"node"},cM={[$O]:{label:te("In Bearbeitung","In progress"),tone:"neutral",phase:dM,external:nn(te("Entwurf","Draft"),"neutral",te("Bewerbung fortsetzen","Continue application"),te("Sie haben die Bewerbung bereits begonnen. Schlie\xDFen Sie sie ab, um sie einzureichen.","You have already started the application. Complete it to submit it."),te("Bewerbung fortsetzen","Continue application"),"continue-form")},[ap]:{label:te("Eingereicht","Submitted"),tone:"blue",phase:dM,external:nn(te("Eingereicht","Submitted"),"blue",te("Ihre Bewerbung ist eingereicht","Your application has been submitted"),te("Ihre Bewerbung ist bei uns eingegangen. Wir melden uns mit den n\xE4chsten Schritten.","We have received your application. We will be in touch with the next steps."))}},uM={role:"user-action",effect:"side-effect",progressDefaults:cM,progressEvents:Gn(cM),actions:s(()=>oM,"actions"),workItemTemplates:s(()=>[E8],"workItemTemplates"),states:Tx,currentState:s(async(e,n)=>{let t=await aM(e,n.applicationId,n.node.id);return t===null?"draft":t.state},"currentState"),inputs:s(e=>[{id:"smartForm",label:{de:"Formular",en:"Form"},type:"smartForm",optionSource:"offerSmartForms",required:e.adoptForm===void 0,inspector:"literal-only"}],"inputs"),outputs:s(e=>[{name:"admission",type:"admission",label:{de:"Anmeldung",en:"Application"},schema:[{key:"beneficiary",type:"personRef",label:{de:"Beschulte Person",en:"Student"}},{key:"signers",type:"personList",label:{de:"Unterzeichner",en:"Signers"}},...e.formExports??[]]}],"outputs"),notificationEvents:s(e=>Ot(e)?[]:[{id:lp,label:{de:"Formular abgesendet",en:"Form submitted"},audience:"external",args:[{key:"applicationId",type:"string",required:!0}]}],"notificationEvents"),validate:s(e=>{let n=[],t=e.inputs?.smartForm,r=t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0,i=e.adoptForm!==void 0;return r&&i?n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.adoptForm`,reason:{de:`[form.adopt-xor-create] Form-Knoten "${e.id}" hat sowohl ein smartForm als auch adoptForm \u2014 genau eines ist erlaubt.`,en:`[form.adopt-xor-create] Form node "${e.id}" has both a smartForm and adoptForm \u2014 exactly one is allowed.`},severity:"error"}):!r&&!i&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.smartForm`,reason:{de:`[form.adopt-xor-create] Form-Knoten "${e.id}" braucht entweder ein smartForm (neu erzeugen) oder adoptForm (bestehende Instanz \xFCbernehmen).`,en:`[form.adopt-xor-create] Form node "${e.id}" needs either a smartForm (create new) or adoptForm (adopt an existing instance).`},severity:"error"}),n},"validate")};var fM={role:"system-action",effect:"side-effect",inputs:s(()=>[{id:Mn.target,label:{de:"Formular",en:"Form"},type:"admission",required:!0,inspector:"binding-only"},{id:Mn.flagKey,label:{de:"Merkmal im Formular",en:"Flag in the form"},type:"formFlag",required:!0,inspector:"literal-only",optionSource:"targetFormFlags"},{id:Mn.value,label:{de:"Setzen oder zur\xFCcknehmen",en:"Raise or lower"},type:"boolean",defaultValue:!0,inspector:"literal-only",enumOptions:[{value:"true",label:{de:"Setzen",en:"Raise"}},{value:"false",label:{de:"Zur\xFCcknehmen",en:"Lower"}}]}],"inputs"),notificationEvents:s(e=>[{id:"unlocked",label:{de:"Abschnitt freigeschaltet",en:"Section unlocked"},audience:"external",required:Y_(e),args:[{key:"applicationId",type:"string",required:!0},{key:"sectionLabel",type:"localizedText",required:!0}]}],"notificationEvents"),validate:s(e=>{let n=[];e.inputs?.[Mn.flagKey]?.kind==="literal"&&Ip(e)===null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${Mn.flagKey}`,reason:{de:`[setFlag/missingFlagKey] setFlag-Knoten "${e.id}" nennt kein Merkmal (Parameter \u201EMerkmal im Formular\u201C).`,en:`[setFlag/missingFlagKey] setFlag node "${e.id}" names no flag (parameter "Flag in the form").`},severity:"error"});let r=e.inputs?.[Mn.value];return r?.kind==="literal"&&typeof r.value!="boolean"&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${Mn.value}`,reason:{de:`[setFlag/valueType] setFlag-Knoten "${e.id}": \u201ESetzen oder zur\xFCcknehmen\u201C ist ein Ja/Nein-Wert (true/false), kein Text.`,en:`[setFlag/valueType] setFlag node "${e.id}": "Raise or lower" is a yes/no value (true/false), not text.`},severity:"error"}),n},"validate")};var T8="true",R8="false",Ix=[{id:T8,label:{de:"Ja",en:"Yes"}},{id:R8,label:{de:"Nein",en:"No"}}];var pM={role:"control",effect:"pure",cardinality:"1-to-N",outcomes:Ix,validate:s((e,n,t)=>$8(e,n,t),"validate")};function $8(e,n,t){let r=s(o=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.condition`,reason:{de:`[if/condition] Knoten "${e.id}": ${o.de}`,en:`[if/condition] Node "${e.id}": ${o.en}`},severity:"error"}),"issue"),i=Ix.filter(o=>e.next?.[o.id]===void 0).map(o=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.next.${o.id}`,reason:{de:`[if/unroutedOutcome] Knoten "${e.id}": Ausgang \u201E${o.label.de}\u201C (${o.id}) f\xFChrt nirgendwohin.`,en:`[if/unroutedOutcome] Node "${e.id}": Outcome "${o.label.en}" (${o.id}) leads nowhere.`},severity:"error"}));return typeof e.condition!="string"||e.condition.trim()===""?[...i,r({de:"Bedingung fehlt.",en:"The condition is missing."})]:[...i,...hm(e.condition,BO(n),t).map(r)]}s($8,"ifNodeIssues");var Ii="decision",I8=new Set(["decision","review"]),zNe=new Set([...I8,"governedDocument"]);var hM=[{id:"approved",label:{de:"Freigeben",en:"Approve"},semantic:"granted"},{id:"rejected",label:{de:"Ablehnen",en:"Reject"},semantic:"rejected"},{id:"waitlisted",label:{de:"Auf Warteliste",en:"Waitlist"},semantic:"waitlisted"}],mM={released:{label:te("Freigegeben","Released"),tone:"green",phase:{key:"freigabe",label:te("Freigabe","Release"),scope:"node"},external:nn(te("Freigegeben","Released"),"green",te("Ihre Bewerbung wurde freigegeben","Your application has been released"),te("Wir haben Ihre Bewerbung freigegeben und melden uns mit den n\xE4chsten Schritten.","We have released your application and will be in touch with the next steps."))}},gs={role:"user-action",effect:"side-effect",outcomes:hM,progressDefaults:mM,progressEvents:Gn(mM),notificationEvents:s(e=>(e.outcomes??[]).map(n=>({id:n.id,label:n.label,audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"comment",type:"string"}]})),"notificationEvents"),actions:s(e=>[...(e.outcomes??[]).map(n=>({id:n.id,kind:"advance",outcome:n.id,label:n.label,...Qi(n.semantic)?{semantic:n.semantic}:{}})),...LC(e)],"actions"),optionalActionKinds:["spawnTasks","skipRule"],workItemTemplates:s(e=>[{key:Ii,recipient:"internal",title:e.decisionAsTask?.title??{de:"Entscheidung",en:"Decision"},unlocks:(e.outcomes??[]).map(n=>n.id).filter(n=>typeof n=="string"&&n.length>0),gatesNode:!1,advancesNode:!0,dueInDays:e.decisionAsTask?.dueInDays}],"workItemTemplates"),taskDocuments:s((e,n)=>n===Ii&&Array.isArray(e.reads)?e.reads.map(t=>({kind:"field",address:t})):[],"taskDocuments"),taskView:s((e,n)=>n===Ii?e.view:void 0,"taskView"),placelessTasks:{[Ii]:"Placed only by the node's authored `view`; a decision that names none is worked in its step wherever the decider opens it."},validate:Ox};function Ox(e,n,t){let r=[],i=e.outcomes??[];i.length===0&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes`,reason:{de:`[decision/missingOutcomes] Entscheidungs-Knoten "${e.id}" hat keine Outcomes \u2014 die Entscheidung w\xE4re niemals aufl\xF6sbar.`,en:`[decision/missingOutcomes] Decision node "${e.id}" has no outcomes \u2014 the decision could never be resolved.`},severity:"error"});let o=new Set(i.map(l=>l.id));for(let l of i){let d=l.label;(typeof d=="string"?d.trim().length>0:d!=null&&typeof d=="object"&&Object.values(d).some(p=>typeof p=="string"&&p.trim().length>0))||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes.${l.id}`,reason:{de:`[decision/outcomeMissingLabel] Outcome "${l.id}" von "${e.id}" hat keine Beschriftung \u2014 sie ist der Text des Knopfs im Cockpit.`,en:`[decision/outcomeMissingLabel] Outcome "${l.id}" of "${e.id}" has no label \u2014 it is the text of the button in the cockpit.`},severity:"error"});let u=l.semantic;u===void 0?r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes.${l.id}.semantic`,reason:{de:`[decision/outcomeSemanticMissing] Outcome "${l.id}" von "${e.id}" sagt nicht, was es bedeutet \u2014 eines von ${It.join(", ")}.`,en:`[decision/outcomeSemanticMissing] Outcome "${l.id}" of "${e.id}" does not say what it means \u2014 one of ${It.join(", ")}.`},severity:"error"}):Qi(u)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes.${l.id}.semantic`,reason:{de:`[decision/outcomeSemanticUnknown] Outcome "${l.id}" von "${e.id}" hat die Bedeutung "${String(u)}" \u2014 erlaubt: ${It.join(", ")}.`,en:`[decision/outcomeSemanticUnknown] Outcome "${l.id}" of "${e.id}" has the meaning "${String(u)}" \u2014 allowed: ${It.join(", ")}.`},severity:"error"})}for(let l of Object.keys(e.commentRequired??{}))o.has(l)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.commentRequired.${l}`,reason:{de:`[decision/commentRequiredUnknownOutcome] Unbekanntes Outcome "${l}" in commentRequired; erlaubt: ${[...o].join(", ")}`,en:`[decision/commentRequiredUnknownOutcome] Unknown outcome "${l}" in commentRequired; allowed: ${[...o].join(", ")}`},severity:"error"});let a=e.decisionAsTask?.title;return a!==void 0&&(a!==null&&typeof a=="object"&&Object.values(a).some(d=>typeof d=="string"&&d.length>0)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.decisionAsTask.title`,reason:{de:"[decision/decisionTaskMissingTitle] decisionAsTask.title ist gesetzt, aber leer \u2014 entweder einen nicht-leeren lokalisierten Text angeben oder das Feld weglassen (dann greift der Standardtitel).",en:"[decision/decisionTaskMissingTitle] decisionAsTask.title is set but empty \u2014 either give a non-empty localized text or omit the field (the default title then applies)."},severity:"error"})),r}s(Ox,"validateDecisionNode");var _x=[{id:"promoted",label:{de:"Nachger\xFCckt",en:"Moved up"}},{id:"closed",label:{de:"Warteliste geschlossen",en:"Waiting list closed"}}],gM=[{id:"complete",label:{de:"Vollst\xE4ndig",en:"Complete"}},{id:"acceptedIncomplete",label:{de:"Ohne Nachreichung abgeschlossen",en:"Closed without the missing documents"}},{id:"rejected",label:{de:"Abgelehnt",en:"Rejected"}},{id:"absage",label:{de:"Zur\xFCckgezogen",en:"Withdrawn"}}];var Px="promoted";var yM="promote",wM="Nachr\xFCcken",Qa="promoteLabel";var O8={de:wM,en:"Promote from waitlist"};function _8(e){let n=e.inputs?.[Qa];if(n===void 0||n.kind==="unset")return O8;let t=n.kind==="literal"?n.value:void 0;return Go(t)!==null&&F(`waitlist node ${e.id}: inputs.${Qa} ${JSON.stringify(n)} is not a { de, en } literal`),t}s(_8,"promoteLabelOf");var Nx={key:"warteliste",label:te("Warteliste","Waitlist"),scope:"global",track:"parked",waitlist:!0},kM={waitlisted:{label:te("Warteliste","Waitlisted"),tone:"amber",phase:Nx,external:nn(te("Warteliste","Waiting list"),"amber",te("Sie stehen auf der Warteliste","You are on the waiting list"),te("Ihre Bewerbung wurde auf die Warteliste gesetzt. Wir informieren Sie, sobald ein Platz frei wird.","Your application has been placed on the waiting list. We will let you know as soon as a place becomes available."))},promoted:{label:te("Nachger\xFCckt","Promoted"),tone:"green",phase:Nx,external:nn(te("Nachger\xFCckt","Moved up"),"green",te("Sie sind nachger\xFCckt","You have moved up"),te("Es ist ein Platz frei geworden \u2014 Ihre Bewerbung l\xE4uft weiter.","A place has become available \u2014 your application continues."))},closed:{label:te("Warteliste geschlossen","Waitlist closed"),tone:"red",phase:Nx,external:nn(te("Warteliste geschlossen","Waiting list closed"),"red",te("Die Warteliste wurde geschlossen","The waiting list has been closed"),te("Leider ist kein Platz mehr frei geworden.","Unfortunately no place has become available."))}},bM={outcomes:_x,inputs:s(()=>[{id:"waitlistOrder",label:{de:"Reihenfolge der Warteliste",en:"Waiting list order"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:rr.map(e=>({value:e,label:n_[e]}))},{id:Qa,label:{de:"Beschriftung \u201ENachr\xFCcken\u201C",en:"Label of \u201CPromote\u201D"},type:"localizedText",required:!1,inspector:"literal-only"}],"inputs"),validate:s((e,n)=>{let t=e.inputs?.[Qa];if(t?.kind==="literal"){let a=Go(t.value);if(a!==null)return[{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${Qa}`,reason:{de:`[waitlist/promoteLabelText] Die Beschriftung \u201ENachr\xFCcken\u201C von "${e.id}" braucht einen Text auf Deutsch und auf Englisch (${a}).`,en:`[waitlist/promoteLabelText] The "Promote" label of "${e.id}" needs a text in German and in English (${a}).`},severity:"error"}]}let r=Aw(e);if(r===null)return[];let i=n.nodes.filter(a=>a.type==="waitlist"&&a.id!==e.id),o=n.nodes.indexOf(e);for(let a of i){if(n.nodes.indexOf(a)>o)continue;let l=Aw(a);if(l!==null&&l.waitlistOrder!==r.waitlistOrder)return[{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs`,reason:{de:`[waitlist/policyConflict] Wartelisten "${a.id}" und "${e.id}" nennen verschiedene Reihenfolgen \u2014 alle Wartelisten eines Prozesses ordnen gleich.`,en:`[waitlist/policyConflict] Waiting lists "${a.id}" and "${e.id}" state different orders \u2014 all waiting lists of a process order alike.`},severity:"error"}]}return[]},"validate"),pausesApplicationTasks:!0,progressDefaults:kM,progressEvents:Gn(kM),notificationEvents:s(()=>[{id:"placed",label:{de:"Auf die Warteliste gesetzt",en:"Placed on the waiting list"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"rank",type:"number"}]},{id:"promoted",label:{de:"Nachger\xFCckt",en:"Promoted from the waiting list"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"rank",type:"number"}]}],"notificationEvents"),actions:s(e=>(e.outcomes!==void 0&&e.outcomes.length>0?e.outcomes:_x).some(t=>t.id===Px)?[{id:yM,kind:"advance",outcome:Px,semantic:"other",label:_8(e),surface:ar,superUserOnly:!0,teamAssignable:!0}]:[],"actions")};var Cx="complete",mc="acceptedIncomplete",Th="rejected",P8="absage",vM="closeWithoutDocuments",xM="rejectAtCompleteness",SM="Ohne Nachreichung abschlie\xDFen",AM="Ablehnen",EM="awaitingDocuments",Dx="documentsComplete",Fx="closedWithoutDocuments",Lx="rejected",Mx="withdrawn",TM="requested",hCe={[Cx]:{event:Dx,status:"complete",endsRole:!0},[mc]:{event:Fx,status:"acceptedIncomplete",endsRole:!1},[Th]:{event:Lx,status:"rejected",endsRole:!0},[P8]:{event:Mx,status:"withdrawn",endsRole:!0}};var hc=s(()=>Ql[0],"beneficiary"),qx=366;function N8(e){let n=e.reads,t=Zl(e).flatMap(({address:r})=>un(r)&&!Ql.includes(r.path)?[r]:[]);return[...Array.isArray(n)?n.filter(un):[],...t]}s(N8,"printedFields");function C8(e,n){let t=de(n);return e.nodes.filter(r=>r.type==="governedDocument"&&N8(r).some(i=>de(i)===t))}s(C8,"documentsPrinting");function D8(e,n){if(!un(n)||n.path!==hc())return!1;let t=e.nodes.find(r=>r.id===n.owner);return t!==void 0&&t.type==="form"&&!Ot(t)}s(D8,"isCreatedFormBeneficiary");function zn(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(zn,"issue");function F8(e,n,t){let r=new Map(e.nodes.map(l=>[l.id,l])),i=n.next??{},o=new Set,a=[Cx,mc].flatMap(l=>{let d=i[l]?.to;return d===void 0?[]:[d]});for(;a.length>0;){let l=a.pop();if(o.has(l))continue;o.add(l);let d=r.get(l);if(d!==void 0&&!(d.type==="review"&&we(d.form)&&ir(d.form)&&d.form.owner===t)){if(d.type==="end"){if(Yo(d)==="approved")return!0;continue}for(let c of Object.values(d.next??{}))a.push(c.to)}}return!1}s(F8,"reachesApprovedEndUnreviewed");var Kx={key:"unterlagen",label:te("Unterlagen nachreichen","Outstanding documents"),scope:"node"},RM={[EM]:{label:te("Unterlagen nachreichen","Outstanding documents"),tone:"amber",phase:Kx,external:nn(te("Unterlagen fehlen","Documents missing"),"amber",te("Bitte reichen Sie die fehlenden Unterlagen nach","Please submit the missing documents"),te("Uns fehlen noch einige Angaben oder Unterlagen. Sie finden die Liste und die Frist in Ihren Aufgaben.","Some details or documents are still missing. You will find the list and the deadline in your tasks."))},[Dx]:{label:te("Unterlagen vollst\xE4ndig","Documents complete"),tone:"green",phase:Kx,external:nn(te("Unterlagen vollst\xE4ndig","Documents complete"),"green",te("Ihre Unterlagen sind vollst\xE4ndig","Your documents are complete"),te("Alle angeforderten Unterlagen liegen uns vor. Vielen Dank.","We have received all the requested documents. Thank you."))},[Fx]:{label:te("Ohne Nachreichung abgeschlossen","Closed without documents"),tone:"neutral",phase:Kx,external:nn(te("Abgeschlossen","Closed"),"neutral",te("Die Nachreichung ist abgeschlossen","The document request is closed"),te("Wir haben die Anforderung der Unterlagen abgeschlossen. Ihre Bewerbung l\xE4uft weiter.","We have closed the document request. Your application continues."))},[Lx]:{label:te("Abgelehnt","Rejected"),tone:"red",phase:nN,external:nn(te("Abgelehnt","Rejected"),"red",te("Leider k\xF6nnen wir Ihnen keinen Platz anbieten","Unfortunately we cannot offer you a place"),te("Wir bedauern, Ihnen mitteilen zu m\xFCssen, dass wir Ihre Bewerbung nicht ber\xFCcksichtigen konnten.","We regret to inform you that we were unable to accept your application."))},[Mx]:{label:te("Zur\xFCckgezogen","Withdrawn"),tone:"red",phase:Yp,external:nn(te("Zur\xFCckgezogen","Withdrawn"),"red",te("Sie haben Ihre Bewerbung zur\xFCckgezogen","You have withdrawn your application"),te("Ihre Bewerbung wird nicht weitergef\xFChrt.","Your application will not be continued."))}},$M={outcomes:gM,progressDefaults:RM,progressEvents:Gn(RM),notificationEvents:s(()=>[{id:TM,label:{de:"Unterlagen angefordert",en:"Documents requested"},audience:"external",required:!0,args:[{key:"applicationId",type:"string",required:!0},{key:"fieldLabels",type:"localizedText",required:!0},{key:"dueAt",type:"number",required:!0}]}],"notificationEvents"),actions:s(e=>{let n=s(r=>e.next?.[r]!==void 0,"wired"),t=[];return n(mc)&&t.push({id:vM,kind:"advance",outcome:mc,semantic:"other",label:{de:SM,en:"Close without documents"},surface:ar,superUserOnly:!0,confirm:{title:{de:"Unterlagen unvollst\xE4ndig",en:"Documents incomplete"},body:{de:"Es geht ohne die fehlenden Unterlagen weiter. Die Anfrage an die Familie wird geschlossen.",en:"The application continues without the missing documents. The request to the family is closed."},confirmLabel:{de:"Abschlie\xDFen",en:"Close"}}}),n(Th)&&t.push({id:xM,kind:"advance",outcome:Th,semantic:"rejected",label:{de:AM,en:"Reject application"},surface:ar,superUserOnly:!0,confirm:{title:{de:"Unterlagen unvollst\xE4ndig",en:"Documents incomplete"},body:{de:"Der Platz wird abgesagt und die Anfrage an die Familie geschlossen. Das l\xE4sst sich nicht r\xFCckg\xE4ngig machen.",en:"The application is rejected and the request to the family is closed. This cannot be undone."},confirmLabel:{de:"Ablehnen",en:"Reject"}}}),t},"actions"),inputs:s(()=>[{id:"person",label:{de:"Person (Gasth\xF6rer-Rolle)",en:"Person (guest role)"},type:"personRef",required:!1},{id:"guestRole",label:{de:"Gastrolle bis zur Nachreichung",en:"Guest role until submitted"},type:"roleKey",required:!1,inspector:"literal-only",optionSource:"tenantRoles"}],"inputs"),validate:s((e,n,t)=>{let r=[],i=`Vollst\xE4ndigkeitspr\xFCfung \u201E${e.label?.de??e.id}\u201C (${e.id})`,o=`Completeness check "${e.label?.en||e.id}" (${e.id})`,a=s(T=>Ve(n,T,"de"),"shown"),l=s(T=>Ve(n,T,"en"),"shownEn"),d=e.requires;if(!Array.isArray(d)||d.length===0)r.push(zn(e,"requires",{de:`[completenessCheck/missingRequires] ${i} nennt keine Felder \u2014 \`requires\` muss mindestens ein Feld eines Formulars enthalten ($node.<formular>.admission.<feld>).`,en:`[completenessCheck/missingRequires] ${o} names no fields \u2014 \`requires\` must contain at least one field of a form ($node.<form>.admission.<field>).`}));else{let T=new Set;for(let E of d){if(!we(E))continue;let $=de(E);if(T.has($)){r.push(zn(e,"requires",{de:`[completenessCheck/duplicateField] Feld ${a(E)} steht doppelt in \`requires\`.`,en:`[completenessCheck/duplicateField] Field ${l(E)} appears twice in \`requires\`.`}));continue}if(T.add($),!un(E)){r.push(zn(e,"requires",{de:`[completenessCheck/unknownField] ${a(E)} ist kein Feld eines Formulars \u2014 \`requires\` nennt Felder ($node.<formular>.admission.<feld>).`,en:`[completenessCheck/unknownField] ${l(E)} is not a field of a form \u2014 \`requires\` names fields ($node.<form>.admission.<field>).`}));continue}let C=ei(t,E);if(C==null)continue;let L=fa("requires",ua(C));L==="computed"||L==="repeated"?r.push(zn(e,"requires",{de:`[completenessCheck/fieldNotRequestable] Feld ${a(E)} ist ${C.kind==="computed"?"berechnet":"ein Feld einer wiederholten Gruppe"} \u2014 die Familie kann es nicht nachreichen.`,en:`[completenessCheck/fieldNotRequestable] Field ${l(E)} is ${C.kind==="computed"?"computed":"a field of a repeated group"} \u2014 the family cannot submit it later.`})):L==="untranslated"&&r.push(zn(e,"requires",{de:`[completenessCheck/fieldNameUntranslated] Feld ${a(E)} (\u201E${to(C,"de")}") hat keinen englischen Namen (Feld oder Person/Abschnitt) \u2014 die Benachrichtigung \u201EUnterlagen angefordert" nennt es in der Sprache der Familie.`,en:`[completenessCheck/fieldNameUntranslated] Field ${l(E)} ("${to(C,"de")}") has no English name (field or person/section) \u2014 the notification "Documents requested" names it in the family's language.`}))}}let c=e.deadline,u=typeof c=="object"&&c!==null?c:{},p="inDays"in u,h="until"in u;if(p===h)r.push(zn(e,"deadline",{de:`[completenessCheck/deadlineShape] Vollst\xE4ndigkeitspr\xFCfung "${e.id}" braucht genau eine Frist: \`{ inDays: n }\` (Tage ab Eintritt) oder \`{ until: "JJJJ-MM-TT" }\`.`,en:`[completenessCheck/deadlineShape] Completeness check "${e.id}" needs exactly one deadline: \`{ inDays: n }\` (days after entry) or \`{ until: "YYYY-MM-DD" }\`.`}));else if(p){let T=u.inDays;(typeof T!="number"||!Number.isInteger(T)||T<0||T>qx)&&r.push(zn(e,"deadline.inDays",{de:`[completenessCheck/deadlineDays] Frist "${String(T)}" ist keine ganze Zahl von 0 bis ${qx} Tagen.`,en:`[completenessCheck/deadlineDays] Deadline "${String(T)}" is not a whole number from 0 to ${qx} days.`}))}else typeof u.until!="string"||wk(u.until)===null?r.push(zn(e,"deadline.until",{de:`[completenessCheck/deadlineDate] Frist "${String(u.until)}" ist kein g\xFCltiges Datum (JJJJ-MM-TT).`,en:`[completenessCheck/deadlineDate] Deadline "${String(u.until)}" is not a valid date (YYYY-MM-DD).`})):u.until<SN(Date.now())&&r.push({...zn(e,"deadline.until",{de:`[completenessCheck/deadlinePassed] Frist "${u.until}" liegt in der Vergangenheit \u2014 jede Anfrage bek\xE4me den Tag des Eintritts als Frist. Datum aktualisieren?`,en:`[completenessCheck/deadlinePassed] Deadline "${u.until}" is in the past \u2014 every request would get the day of entry as its deadline. Update the date?`}),severity:"warning"});if(Array.isArray(d)){let T=new Map(d.filter(un).map(E=>[de(E),E]));for(let E of T.values())for(let $ of C8(n,E))r.push(zn(e,"requires",{de:`[completenessCheck/requiresConsumedUpstream] Feld ${a(E)} flie\xDFt in das Dokument \u201E${$.label?.de??$.id}" (${$.id}) ein \u2014 nach dessen Ausstellung kann die Familie es nicht mehr nachreichen. Feld aus \`requires\` oder aus dem Dokument nehmen.`,en:`[completenessCheck/requiresConsumedUpstream] Field ${l(E)} flows into the document "${$.label?.en||$.id}" (${$.id}) \u2014 once it is issued, the family can no longer submit it later. Remove the field from \`requires\` or from the document.`}))}if(Array.isArray(d)&&t!==void 0){let T=d.filter(un).filter(C=>{let L=ei(t,C);return L!=null&&gm(L)}),$=[...new Set(T.map(C=>C.owner))].filter(C=>F8(n,e,C));if($.length>0){let C=T.filter(L=>$.includes(L.owner));r.push({...zn(e,"next",{de:`[review/unreviewedAfterSupply] ${C.map(a).join(", ")} ist pr\xFCfpflichtig und wird hier nachgereicht, aber nach \u201Evollst\xE4ndig\u201C oder \u201Eohne Nachreichung\u201C f\xFChrt ein Weg ohne Pr\xFCfknoten dieses Formulars zur Aufnahme \u2014 niemand pr\xFCft das Nachgereichte. Dort einen Pr\xFCfknoten einf\xFCgen (z. B. \u201EWenn nichts zu pr\xFCfen ist: Durchreichen\u201C).`,en:`[review/unreviewedAfterSupply] ${C.map(l).join(", ")} requires review and is supplied here, but after "complete" or "accepted incomplete" a path without a review node of this form leads to admission \u2014 nobody reviews what was supplied. Insert a review node there (e.g. "When nothing is owed: pass through").`}),severity:"warning"})}}let y=e.inputs?.guestRole,k=y?.kind==="literal"?y.value:void 0,w=e.inputs?.person,b=w?.kind==="binding"?w.address:null;k!==void 0&&(typeof k!="string"||k.trim()===""?r.push(zn(e,"inputs.guestRole",{de:"[completenessCheck/guestRoleEmpty] `guestRole` ist leer \u2014 Rollenschl\xFCssel angeben oder das Feld weglassen.",en:"[completenessCheck/guestRoleEmpty] `guestRole` is empty \u2014 give a role key or omit the field."})):t?.roleKeys!==void 0&&!t.roleKeys.has(k)?r.push(zn(e,"inputs.guestRole",{de:`[completenessCheck/unknownRole] Rolle "${k}" existiert nicht im Rollenkatalog des Mandanten. Bekannte Rollen: ${[...t.roleKeys].sort().join(", ")}.`,en:`[completenessCheck/unknownRole] Role "${k}" does not exist in this school's role catalog. Known roles: ${[...t.roleKeys].sort().join(", ")}.`})):t?.assignableRoleKeys!==void 0&&!t.assignableRoleKeys.has(k)&&r.push(zn(e,"inputs.guestRole",{de:`[completenessCheck/nonLeafRole] Rolle "${k}" hat untergeordnete Rollen und ist nicht vergebbar.`,en:`[completenessCheck/nonLeafRole] Role "${k}" has sub-roles and cannot be assigned.`})),b===null&&r.push(zn(e,"inputs.person",{de:`[completenessCheck/guestRoleNeedsPerson] ${i} vergibt die Rolle "${String(k)}", aber der Eingang \u201Eperson" ist nicht gebunden (z. B. an $node.<formular>.${Un}.${hc()}).`,en:`[completenessCheck/guestRoleNeedsPerson] ${o} assigns the role "${String(k)}", but the input "person" is not bound (e.g. to $node.<form>.${Un}.${hc()}).`}))),we(b)&&!D8(n,b)&&r.push(zn(e,"inputs.person",{de:`[completenessCheck/personNotFormParty] Eingang \u201Eperson" ist an ${a(b)} gebunden \u2014 die Pr\xFCfung vergibt die Rolle der Person, f\xFCr die ein Formular abgeschickt wurde ($node.<anlegender Formularknoten>.${Un}.${hc()}).`,en:`[completenessCheck/personNotFormParty] The input "person" is bound to ${l(b)} \u2014 the check assigns the role to the person a form was submitted for ($node.<creating form node>.${Un}.${hc()}).`})),b!==null&&k===void 0&&r.push(zn(e,"inputs.person",{de:'[completenessCheck/personWithoutRole] Eingang \u201Eperson" ist gebunden, aber es wird keine Rolle vergeben \u2014 die Bindung wirkt nicht.',en:'[completenessCheck/personWithoutRole] The input "person" is bound, but no role is assigned \u2014 the binding has no effect.'}));for(let T of["complete","rejected"])e.next?.[T]===void 0&&r.push(zn(e,`next.${T}`,{de:`[completenessCheck/unroutedOutcome] Vollst\xE4ndigkeitspr\xFCfung "${e.id}" leitet den Ausgang "${T}" nirgendwohin.`,en:`[completenessCheck/unroutedOutcome] Completeness check "${e.id}" routes the outcome "${T}" nowhere.`}));return r},"validate")};var L8=[{id:r_,label:{de:"Gepr\xFCft",en:"Reviewed"},semantic:"other"}],Rh=s(e=>e,"asDecision"),IM={[i_]:{label:te("Eingereicht","Submitted"),tone:"blue",phase:{key:"pruefung",label:te("In Pr\xFCfung","In review"),scope:"node"},external:nn(te("Eingereicht","Submitted"),"blue",te("Ihre Bewerbung wird gepr\xFCft","Your application is being reviewed"),te("Ihre Bewerbung ist bei uns eingegangen. Wir pr\xFCfen jetzt Ihre Unterlagen und melden uns, falls etwas fehlt.","We have received your application. We are now reviewing your documents and will get in touch if anything is missing."))}},OM={role:"user-action",effect:"side-effect",outcomes:L8,progressDefaults:IM,progressEvents:Gn(IM),notificationEvents:s(e=>gs.notificationEvents(Rh(e)),"notificationEvents"),inputs:s(()=>[{id:dr,label:{de:"Wenn nichts zu pr\xFCfen ist",en:"When nothing is owed"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:as.map(e=>({value:e,label:UD[e]}))}],"inputs"),actions:s(e=>[...gs.actions(Rh(e)).map(n=>n.kind==="advance"&&(e.outcomes??[]).length===1?{...n,label:{de:"Pr\xFCfung abschlie\xDFen",en:"Complete review"}}:n),{id:Rw,kind:"internal",label:{de:"Feld abhaken",en:"Tick field"}}],"actions"),optionalActionKinds:gs.optionalActionKinds,workItemTemplates:s(e=>gs.workItemTemplates(Rh(e)).map(n=>n.key===Ii?{...n,title:e.decisionAsTask?.title??{de:"Angaben pr\xFCfen",en:"Review the application"},unlocks:[...n.unlocks,Rw]}:n),"workItemTemplates"),taskDocuments:s(()=>[],"taskDocuments"),taskView:s((e,n)=>n===Ii&&e.form!==void 0&&ir(e.form)?{kind:"form",form:e.form.owner,view:iD}:void 0,"taskView"),placelessTasks:{[Ii]:"A review without a form has no checklist to tick; its row is finished in its step (\u201EPr\xFCfung abschlie\xDFen\u201C)."},validate:s((e,n,t)=>{let r=Ox(Rh(e),n,t);for(let c of e.outcomes??[]){let u=c.semantic;typeof u!="string"||!vp.includes(u)||r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes`,reason:{de:`[review/rejectingOutcome] Pr\xFCf-Knoten "${e.id}" deklariert das Outcome "${c.id}" mit der Bedeutung "${String(u)}" \u2014 eine Pr\xFCfung lehnt nicht ab und setzt nicht auf die Warteliste; das ist die Entscheidung der Freigabe bzw. \u201EBewerbung ablehnen".`,en:`[review/rejectingOutcome] Review node "${e.id}" declares the outcome "${c.id}" meaning "${String(u)}" \u2014 a review neither rejects nor waitlists; that is the decision of the approval or "Reject application".`},severity:"error"})}let i={de:`\u201E${e.label?.de??e.id}\u201C (${e.id})`,en:`"${e.label?.en||e.id}" (${e.id})`},o=e.inputs?.[dr],a=GD(e);o!==void 0&&a===null&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.inputs.${dr}`,reason:{de:`[review/unknownMode] Pr\xFCf-Knoten ${i.de}: \u201EWenn nichts zu pr\xFCfen ist\u201C muss ${as.join(" oder ")} als fester Wert sein.`,en:`[review/unknownMode] Review node ${i.en}: "When nothing is owed" must be the literal ${as.join(" or ")}.`},severity:"error"});let l=a==="advance",d=e.form;if(l&&d===void 0&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.form`,reason:{de:`[review/advanceNeedsForm] Pr\xFCf-Knoten ${i.de} reicht durch, wenn nichts zu pr\xFCfen ist, nennt aber kein Formular \u2014 er w\xFCrde immer durchreichen. Nenne das Formular, dessen pr\xFCfpflichtige Felder er pr\xFCft.`,en:`[review/advanceNeedsForm] Review node ${i.en} passes through when nothing is owed but names no form \u2014 it would always pass through. Name the form whose review-required fields it checks.`},severity:"error"}),l&&(e.outcomes??[]).length!==1&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.outcomes`,reason:{de:`[review/advanceOneOutcome] Pr\xFCf-Knoten ${i.de} reicht durch, hat aber ${(e.outcomes??[]).length} Outcomes \u2014 durchgereicht wird \xFCber genau eines.`,en:`[review/advanceOneOutcome] Review node ${i.en} passes through but has ${(e.outcomes??[]).length} outcomes \u2014 it passes through over exactly one.`},severity:"error"}),we(d)&&ir(d)){let c=t?.readinessFormFieldsByFormNode?.get(d.owner);c!==void 0&&![...c.values()].some(gm)&&r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.form`,reason:l?{de:`[review/nothingDeclared] Pr\xFCf-Knoten ${i.de} pr\xFCft ${de(d)}, aber dieses Formular erkl\xE4rt kein Feld als pr\xFCfpflichtig \u2014 der Schritt w\xFCrde jedes Mal durchreichen. Markiere die Felder im Formular als \u201EPr\xFCfpflichtig\u201C.`,en:`[review/nothingDeclared] Review node ${i.en} reviews ${de(d)}, but that form declares no field review-required \u2014 the step would pass through every time. Mark the fields "Review required" in the form.`}:{de:`[review/nothingDeclared] Pr\xFCf-Knoten ${i.de} pr\xFCft ${de(d)}, aber dieses Formular erkl\xE4rt kein Feld als pr\xFCfpflichtig \u2014 der Schritt wartet, ohne dass etwas abzuhaken ist. Markiere die Felder im Formular als \u201EPr\xFCfpflichtig\u201C.`,en:`[review/nothingDeclared] Review node ${i.en} reviews ${de(d)}, but that form declares no field review-required \u2014 the step waits with nothing to tick. Mark the fields "Review required" in the form.`},severity:l?"error":"warning"})}return r},"validate")};var _M=["awaitingAnswer","answered"];async function PM(e,n){return(await va(e,{applicationId:n.applicationId,nodeId:n.nodeId})).filter(r=>r.templateKey===n.templateKey).some(r=>r.isOpen)?"awaitingAnswer":"answered"}s(PM,"externalRequestState");var DM=[{id:zo,label:{de:"Bezahlt",en:"Paid"}}],eDe=new Set(DM.map(e=>e.id));var M8=zo,NM=[{id:M8,kind:"advance",outcome:zo,semantic:"other",label:{de:"Zahlung eingegangen",en:"Payment received"},availableIn:["awaitingAnswer"]}],q8={id:ek,kind:"advance",outcome:zo,semantic:"other",label:{de:"Zahlungseingang best\xE4tigen",en:"Confirm payment received"},surface:ar,confirm:{title:{de:"Zahlungseingang best\xE4tigen",en:"Confirm payment received"},body:{de:"Die Geb\xFChr ist au\xDFerhalb von Plexus eingegangen. Der Schritt wird als separat bezahlt abgeschlossen, die Aufgabe der Familie schlie\xDFt mit.",en:"The fee was received outside Plexus. The step is completed as paid separately; the family's task closes with it."},confirmLabel:{de:"Best\xE4tigen",en:"Confirm"}}},K8={id:Xw,kind:"advance",outcome:zo,semantic:"other",label:{de:"Zahlung \xFCberspringen",en:"Skip payment"},surface:ar,superUserOnly:!0,confirm:{title:{de:"Zahlung \xFCberspringen",en:"Skip payment"},body:{de:"Die Geb\xFChr wird au\xDFerhalb von Plexus abgerechnet. Der Schritt wird ohne Zahlung abgeschlossen; es wird kein Betrag als bezahlt verbucht.",en:"The fee is billed outside Plexus. The step is completed without a payment; no amount is recorded as paid."},confirmLabel:{de:"\xDCberspringen",en:"Skip"}}},j8={id:Xw,kind:"advance",outcome:zo,semantic:"other",label:{de:"Ohne Online-Zahlung abschlie\xDFen",en:"Close without online payment"},surface:ar,superUserOnly:!0,availableIn:["awaitingAnswer"],confirm:{title:{de:"Ohne Online-Zahlung abschlie\xDFen",en:"Close without online payment"},body:{de:"Die Familie hat nicht online \xFCber Plexus bezahlt. Der Schritt wird ohne Online-Zahlung abgeschlossen; eine offene Zahlungsseite wird geschlossen. Bitte den Grund angeben (z. B. bar bezahlt).",en:"The family did not pay online through Plexus. The step is completed without an online payment; an open payment page is closed. Please give the reason (e.g. paid in cash)."},confirmLabel:{de:"Abschlie\xDFen",en:"Complete"}},commentRequired:!0};function jx(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(jx,"literalOf");function fo(e){let n=jx(e,ut);return Pp(n)?n:null}s(fo,"modeOrNull");function V8(e){let n=jx(e,eo);return typeof n=="string"&&n.length>0?n:null}s(V8,"articleKeyOrNull");function B8(e){let n=jx(e,or);return typeof n=="string"&&n.length>0&&n===n.trim()?n:null}s(B8,"payeeKeyOrNull");var U8={id:eo,label:{de:"Artikel",en:"Article"},type:"article",required:!0,inspector:"literal-only",optionSource:"programArticles"},G8={id:ut,label:{de:"Zahlungsweg",en:"Payment mode"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"manual",label:{de:"Manuell (\xDCberweisung an die Schule)",en:"Manual (transfer to the school)"}},{value:"online",label:{de:"Online (Stripe)",en:"Online (Stripe)"}}]},z8={id:no,label:{de:"Hinweis f\xFCr die Familie",en:"Note for the family"},type:"localizedText",required:!1,inspector:"literal-only"},W8={id:or,label:{de:"Zahlungsempf\xE4nger (Tr\xE4ger)",en:"Payee (legal entity)"},type:"legalEntity",required:!0,inspector:"literal-only",optionSource:"tenantTraeger"};function Y8(e){return[U8,G8,...fo(e)==="online"?[W8]:[],z8]}s(Y8,"collectPaymentInputs");var H8=["amount","currency","settlement"],J8={de:"Zahlungseingang best\xE4tigen",en:"Confirm payment received"},Q8={de:"Bewerbungsgeb\xFChr bezahlen",en:"Pay the application fee"};function Z8(e,n){if(fo(e)!=="online")return[];let t=B8(e);if(t===null)return[];let r=`nodes.${e.id}.inputs.${or}`,i=s(o=>({layer:"GRAPH",kind:"nodeRule",path:r,reason:o,severity:"error"}),"at");return n?.traeger!==void 0&&!n.traeger.has(t)?[i({de:`[collectPayment/unknownPayee] Zahlungsempf\xE4nger \u201E${t}" ist kein Tr\xE4ger dieses Mandanten \u2014 bekannt: ${[...n.traeger.keys()].join(", ")||"(keiner)"}.`,en:`[collectPayment/unknownPayee] Payee "${t}" is not a legal entity of this school \u2014 known: ${[...n.traeger.keys()].join(", ")||"(none)"}.`})]:n?.stripeReadyTraegerKeys!==void 0&&!n.stripeReadyTraegerKeys.has(t)?[i({de:`[collectPayment/onlineWithoutStripe] Zahlungsweg \u201Eonline" an \u201E${t}" setzt voraus, dass dieser Tr\xE4ger ein einsatzbereites Stripe-Konto hat (Administration \u2192 Integrationen \u2192 Stripe, Tr\xE4ger \u201E${t}") \u2014 sonst kann keine Familie bezahlen. Bis dahin \u201Emanual" w\xE4hlen.`,en:`[collectPayment/onlineWithoutStripe] Payment mode "online" to "${t}" requires this legal entity to have a ready Stripe account (Administration \u2192 Integrations \u2192 Stripe, legal entity "${t}") \u2014 otherwise no family can pay. Until then, choose "manual".`})]:[]}s(Z8,"payeeIssues");var CM={awaitingPayment:{label:te("Zahlung ausstehend","Awaiting payment"),tone:"amber",phase:{key:"zahlung",label:te("Zahlung","Payment"),scope:"node"},external:nn(te("Zahlung offen","Payment due"),"amber",te("Bitte begleichen Sie die Anmeldegeb\xFChr","Please pay the application fee"),te("Ihre Bewerbung l\xE4uft weiter, sobald die Zahlung bei uns eingegangen ist.","Your application continues as soon as we have received the payment."))}},FM={outputs:s(()=>[{name:M_,type:"object",label:{de:"Zahlung",en:"Payment"}}],"outputs"),role:"user-action",effect:"side-effect",inputs:s(e=>Y8(e),"inputs"),outcomes:DM,progressDefaults:CM,progressEvents:Gn(CM),notificationEvents:s(e=>fo(e)!=="online"?[]:[{id:"requested",label:{de:"Zahlung angefordert",en:"Payment requested"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"amount",type:"number",required:!0}]}],"notificationEvents"),actions:s(e=>{let n=fo(e);return n==="online"?[...NM,j8]:n==="manual"?[q8,K8]:[]},"actions"),states:_M,currentState:s((e,n)=>PM(e,{applicationId:n.applicationId,nodeId:n.node.id,templateKey:fo(n.node)==="manual"?$x:Rx}),"currentState"),placelessTasks:{[si]:"A payment has no document or form view; the team confirms it in its step's action bar."},workItemTemplates:s(e=>{let n=e,t=fo(n);return t==="manual"?[{key:si,recipient:"internal",title:J8,unlocks:[ek],advancesNode:!0},{key:$x,recipient:"external",title:Q8,unlocks:[],informational:!0,advancesNode:!1}]:t!=="online"?[]:[{key:Rx,recipient:"external",title:n.label,unlocks:NM.map(r=>r.id),advancesNode:!0}]},"workItemTemplates"),validate:s((e,n,t)=>{let r=[],i=s((d,c)=>r.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${d}`,reason:c,severity:"error"}),"push");for(let d of H8)d in e&&i(d,{de:`[collectPayment/retiredField] \u201E${d}" steht nicht mehr am Zahlungsknoten \u2014 Betrag und W\xE4hrung kommen aus dem Artikel (Parameter \u201EArtikel"), der Zahlungsweg ist der Parameter \u201EZahlungsweg" (inputs.mode).`,en:`[collectPayment/retiredField] "${d}" is no longer on the payment node \u2014 amount and currency come from the article (parameter "Article"), and the payment mode is the parameter "Payment mode" (inputs.mode).`});r.push(...Z8(e,t)),fo(e)==="manual"&&e.assign?.[si]===void 0&&i("assign",{de:"[collectPayment/assign] Die Geb\xFChr wird manuell bezahlt, aber kein Team best\xE4tigt den Zahlungseingang \u2014 `assign.confirmPayment` nennt das Team.",en:"[collectPayment/assign] The fee is paid manually, but no team confirms the payment \u2014 `assign.confirmPayment` names the team."}),fo(e)===null&&i(`inputs.${ut}`,{de:`[collectPayment/invalidMode] Zahlungsweg muss einer von ${aa.join(", ")} sein (online = die Familie zahlt im Portal, manual = die Schule erh\xE4lt das Geld au\xDFerhalb von Plexus); erhalten ${JSON.stringify(e.inputs?.[ut])}.`,en:`[collectPayment/invalidMode] Payment mode must be one of ${aa.join(", ")} (online = the family pays in the portal, manual = the school receives the money outside Plexus); received ${JSON.stringify(e.inputs?.[ut])}.`});let o=e.inputs?.[no];if(o?.kind==="literal"){let d=Go(o.value);d!==null&&i(`inputs.${no}`,{de:`[collectPayment/reasonText] Der Hinweis f\xFCr die Familie braucht einen Text auf Deutsch und auf Englisch (${d}).`,en:`[collectPayment/reasonText] The note for the family needs a text in German and in English (${d}).`})}let a=V8(e);if(a===null)return i(`inputs.${eo}`,{de:'[collectPayment/missingArticle] Der Zahlungsknoten nennt keinen Artikel \u2014 unter \u201EParameter" einen einmaligen Artikel des Programms w\xE4hlen (Finanzen \u2192 Artikel).',en:'[collectPayment/missingArticle] The payment node names no article \u2014 under "Parameters" choose a one-time article of the program (Finance \u2192 Articles).'}),r;let l=`inputs.${eo}`;return t?.billingItemKeys!==void 0&&!t.billingItemKeys.has(a)?(i(l,{de:`[collectPayment/unknownArticle] Artikel \u201E${a}" \u2014 kein Artikel dieses Mandanten tr\xE4gt diesen Schl\xFCssel.`,en:`[collectPayment/unknownArticle] Article "${a}" \u2014 no article of this school has this key.`}),r):(t?.oneTimeBillingItemKeys!==void 0&&!t.oneTimeBillingItemKeys.has(a)&&i(l,{de:`[collectPayment/articleNotOneTime] Artikel \u201E${a}" ist kein einmaliger Artikel \u2014 eine Geb\xFChr nimmt nur ${nk.join(", ")}.`,en:`[collectPayment/articleNotOneTime] Article "${a}" is not a one-time article \u2014 a fee only takes ${nk.join(", ")}.`}),t?.offerProgram===null?i(l,{de:"[collectPayment/articleOfferWithoutProgram] Das Angebot ist keinem Programm zugeordnet, also geh\xF6rt kein Artikel zu ihm; dem Angebot ein Programm geben.",en:"[collectPayment/articleOfferWithoutProgram] The offer is not assigned to a program, so no article belongs to it; give the offer a program."}):t?.offerProgram?.directBillingItemKeys!==void 0&&!t.offerProgram.directBillingItemKeys.has(a)&&i(l,{de:`[collectPayment/articleNotInProgram] Artikel \u201E${a}" ist dem Programm \u201E${t.offerProgram.nameDe}" des Angebots nicht direkt zugeordnet \u2014 unter Finanzen \u2192 Artikel zuordnen (ein Paket z\xE4hlt nicht: es kann den Artikel anders bepreisen).`,en:`[collectPayment/articleNotInProgram] Article "${a}" is not directly assigned to the offer's program "${t.offerProgram.nameDe}" \u2014 assign it under Finance \u2192 Articles (a package does not count: it can price the article differently).`}),r)},"validate")};function LM(e){return{de:`[governedDocument/localeFieldMissing] Die Vorlage "${e}" nennt kein Sprachfeld \u2014 ein Schreiben entsteht in genau einer Sprache. Ein Pflicht-Auswahlfeld mit den Optionen de/en unter den Parametern der Vorlage anlegen, es als localeField der Vorlage nennen und im Knoten an die Sprache des Benutzerkontos binden ($env.applicant.language); die Word-Datei h\xE4lt je Sprache einen Abschnitt <<#input.<feld>.de>> \u2026 <</input.<feld>.de>>.`,en:`[governedDocument/localeFieldMissing] The template "${e}" names no language field \u2014 a letter is written in exactly one language. Create a required choice field with the options de/en among the template's parameters, name it as the template's localeField and bind it in the node to the language of the user account ($env.applicant.language); the Word file holds one section per language <<#input.<field>.de>> \u2026 <</input.<field>.de>>.`}}s(LM,"localeFieldMissingText");var Vx=new Set(["string","email","tel","number","date","boolean","enum","pricedItem"]),MM=/^[a-z][a-z0-9_]*$/;function qM(e,n){let t=[],r=e?.fields;if(!Array.isArray(r))return[{path:"",reason:{de:`[governedDocument/missingTemplateFields] Die Vorlage "${n}" deklariert keine Parameter \u2014 erwartet wird { fields } (die Platzhalter input.<schl\xFCssel>, die ein Knoten f\xFCllt).`,en:`[governedDocument/missingTemplateFields] The template "${n}" declares no parameters \u2014 expected { fields } (the placeholders input.<key> a node fills).`}}];let i=r,o=new Set;for(let a of i){if(typeof a?.key!="string"||!MM.test(a.key)||o.has(a.key)){t.push({path:`fields.${String(a?.key)}`,reason:{de:`[governedDocument/templateFieldKey] Feld "${String(a?.key)}" der Vorlage "${n}" ist ${o.has(a?.key)?"doppelt":"kein g\xFCltiger Schl\xFCssel"} \u2014 erlaubt sind eindeutige Kleinbuchstaben, Ziffern und _ (gedruckt als input.<schl\xFCssel>).`,en:`[governedDocument/templateFieldKey] Field "${String(a?.key)}" of the template "${n}" is ${o.has(a?.key)?"duplicated":"not a valid key"} \u2014 allowed are unique lower-case letters, digits and _ (printed as input.<key>).`}});continue}o.add(a.key);let l=`fields.${a.key}`;if(!Xi(a.type)){t.push({path:l,reason:{de:`[governedDocument/unknownFieldType] Vorlage "${n}" typisiert das Feld "${a.key}" als "${String(a.type)}" \u2014 das geh\xF6rt nicht zum Wert-Vokabular der Plattform (${sa.join(", ")}).`,en:`[governedDocument/unknownFieldType] Template "${n}" types the field "${a.key}" as "${String(a.type)}" \u2014 that is not part of the platform's value vocabulary (${sa.join(", ")}).`}});continue}if(Vx.has(a.type)||t.push({path:l,reason:{de:`[governedDocument/templateFieldType] Feld "${a.key}" der Vorlage "${n}" hat den Typ "${a.type}" \u2014 ein Dokument aus einer Vorlage druckt nur ${[...Vx].join(", ")}.`,en:`[governedDocument/templateFieldType] Field "${a.key}" of the template "${n}" has the type "${a.type}" \u2014 a document from a template only prints ${[...Vx].join(", ")}.`}}),a.type==="enum"&&Array.isArray(a.options)&&a.options.some(d=>!MM.test(String(d.value)))&&t.push({path:l,reason:{de:`[governedDocument/templateFieldKey] Auswahlfeld "${a.key}" der Vorlage "${n}" hat Optionen, die kein Platzhalter adressieren kann (${a.options.map(d=>d.value).join(", ")}) \u2014 Optionswerte sind Kleinbuchstaben, Ziffern und _ (gedruckt als input.${a.key}.<option>).`,en:`[governedDocument/templateFieldKey] Select field "${a.key}" of the template "${n}" has options no placeholder can address (${a.options.map(d=>d.value).join(", ")}) \u2014 option values are lower-case letters, digits and _ (printed as input.${a.key}.<option>).`}}),a.type==="enum"&&(!Array.isArray(a.options)||a.options.length===0)&&t.push({path:l,reason:{de:`[governedDocument/templateFieldOptions] Auswahlfeld "${a.key}" der Vorlage "${n}" nennt keine Optionen \u2014 ohne sie gibt es keine Abschnitte input.${a.key}.<option>.`,en:`[governedDocument/templateFieldOptions] Select field "${a.key}" of the template "${n}" names no options \u2014 without them there are no sections input.${a.key}.<option>.`}}),a.type==="pricedItem"){let d=i.find(c=>c.key===a.priceDate);(d===void 0||d.type!=="date")&&t.push({path:l,reason:{de:`[governedDocument/templateFieldPriceDate] Preisfeld "${a.key}" der Vorlage "${n}" nennt kein Preisdatum \u2014 priceDate muss ein Datumsfeld derselben Vorlage sein (welche Preisversion gilt); genannt: ${JSON.stringify(a.priceDate)}.`,en:`[governedDocument/templateFieldPriceDate] Price field "${a.key}" of the template "${n}" names no price date \u2014 priceDate must be a date field of the same template (which price version applies); named: ${JSON.stringify(a.priceDate)}.`}})}else a.priceDate!==void 0&&t.push({path:l,reason:{de:`[governedDocument/templateFieldPriceDate] Feld "${a.key}" setzt priceDate, ist aber kein Preisfeld (pricedItem).`,en:`[governedDocument/templateFieldPriceDate] Field "${a.key}" sets priceDate but is not a price field (pricedItem).`}});a.processSource==="countersignature"?t.push({path:l,reason:{de:`[governedDocument/countersignatureInTemplate] Feld "${a.key}" wird bei einer Gegenzeichnung gesetzt \u2014 ein Dokument aus einer Vorlage wird nicht gegengezeichnet.`,en:`[governedDocument/countersignatureInTemplate] Field "${a.key}" is set at a countersignature \u2014 a document from a template is not countersigned.`}}):a.processSource!==void 0&&!Tm.includes(a.processSource)&&t.push({path:l,reason:{de:`[governedDocument/unknownProcessSource] Feld "${a.key}" nennt die unbekannte Vorgangsquelle "${String(a.processSource)}" \u2014 bekannt sind ${Tm.join(", ")}.`,en:`[governedDocument/unknownProcessSource] Field "${a.key}" names the unknown case source "${String(a.processSource)}" \u2014 known are ${Tm.join(", ")}.`}})}return t.push(...X8(e,n)),t}s(qM,"templateParameterIssues");function X8(e,n){if(e.localeField===void 0)return[{path:"localeField",reason:LM(n)}];let t=e.fields.find(i=>i.key===e.localeField),r=t===void 0?{de:"nennt kein Feld der Vorlage",en:"names no field of the template"}:t.type!=="enum"?{de:`ist ${t.type}, erwartet wird ein Auswahlfeld (enum)`,en:`is ${t.type}, a select field (enum) is expected`}:t.required!==!0?{de:"ist kein Pflichtfeld \u2014 ohne Sprache gibt es keine Variante",en:"is not a required field \u2014 without a language there is no variant"}:(t.options??[]).length===0?{de:"hat keine Optionen",en:"has no options"}:(t.options??[]).some(i=>!Be.includes(i.value))?{de:`hat Optionen, die keine Sprache sind (erlaubt: ${Be.join(", ")})`,en:`has options that are not a language (allowed: ${Be.join(", ")})`}:null;return r===null?[]:[{path:"localeField",reason:{de:`[governedDocument/localeField] Das Sprachfeld "${e.localeField}" der Vorlage "${n}" ${r.de}.`,en:`[governedDocument/localeField] The language field "${e.localeField}" of the template "${n}" ${r.en}.`}}]}s(X8,"localeFieldIssues");function KM(e,n){if(n===null){delete e.templateStamp;return}e.templateStamp={fields:structuredClone(n.fields),...n.localeField===void 0?{}:{localeField:n.localeField}}}s(KM,"applyTemplateStamp");var Bx=50;async function $h(e,n){let t=await e.db.query("signing_returns").withIndex("by_signingRequestId",r=>r.eq("signingRequestId",n)).take(Bx+1);return t.length>Bx&&F(`signing_returns: Vorgang ${n} has more than ${Bx} returns`),t}s($h,"returnsOf");var Ux=50;async function Gx(e,n){let t=await e.db.query("signing_return_documents").withIndex("by_signingReturnId_and_order",r=>r.eq("signingReturnId",n)).take(Ux+1);return t.length>Ux&&F(`signing_returns: return ${n} has more than ${Ux} files`),t.length===0&&F(`[signing/noDocument] return ${n} carries no file`),t}s(Gx,"returnDocumentsOf");async function jM(e,n){let t=await Gx(e,n);return t.length!==1&&F(`[signing/severalDocuments] return ${n} carries ${t.length} files; this reader handles one`),t[0]}s(jM,"soleReturnDocumentOf");var Ih=200,bDe=Ih*20;async function eZ(e,n){let t=await e.db.get(n);return t===null&&F(`[process] application ${n} not found`),t.redactedAt!==void 0}s(eZ,"processRedacted");async function zx(e,n){await eZ(e,n)&&ae("CONFLICT",{de:"Die Daten dieser Bewerbung wurden gel\xF6scht.",en:"The data of this application has been deleted."})}s(zx,"assertProcessReadable");function nZ(e){let n={_id:e._id,_creationTime:e._creationTime,owner:e.owner,key:e.key};return e.scope==="task"?{...n,scope:"task",result:{kind:"value",value:e.value},writtenByTaskId:e.writtenByTaskId}:{...n,scope:"node",result:e.result}}s(nZ,"rowOf");async function VM(e,n,t){await zx(e,n);let r=await e.db.query("process_store_entries").withIndex("by_applicationId_and_scope_and_owner_and_key",i=>i.eq("applicationId",n).eq("scope",t.scope).eq("owner",t.owner).eq("key",t.key)).order("desc").take(Ih+1);return r.length>Ih&&F(`[process] application ${n} has more than ${Ih} results of ${t.scope}.${t.owner}.${t.key}`),r.map(nZ)}s(VM,"storeHistory");async function tZ(e,n,t){if(t.key===Un){await zx(e,n);let i=await e.db.query("smart_form_instances").withIndex("by_applicationId_and_formNodeId",o=>o.eq("applicationId",n).eq("formNodeId",t.owner)).unique();return i===null||i.state!=="committed"?{state:"pending",reason:null}:{state:"present",result:{kind:"ref",ref:{kind:"form",formInstanceId:i._id}},row:null}}let[r]=await VM(e,n,{scope:"node",owner:t.owner,key:t.key});return r===void 0?{state:"pending",reason:null}:{state:"present",result:r.result,row:r}}s(tZ,"nodeResultAt");async function Oh(e,n){let t={scope:"node",owner:n.nodeId,key:n.key};return rZ(await tZ(e,n.applicationId,t),t,n.applicationId)}s(Oh,"readOwnResult");function rZ(e,n,t){return e.state!=="present"?{state:"pending"}:(e.result.kind!=="ref"&&F(`[process] ${de(n)} of application ${t} holds a value \u2014 this address holds a ref`),{state:"ref",ref:e.result.ref,row:e.row})}s(rZ,"refOf");var Wx={pending:"open",sent:"open",partially_signed:"open",completed:"terminal",declined:"terminal",voided:"terminal",expired:"terminal",failed:"terminal"},iZ=Object.keys(Wx),oZ=iZ.filter(e=>Wx[e]==="open"),IDe=oZ.filter(e=>e!=="pending");function BM(e){return Wx[e]==="terminal"}s(BM,"isTerminalSigningStatus");var po=["docusign","insign"];var gc={docusign:"DocuSign",insign:"inSign",manual:"Auf Papier",simulated:"Simuliert (Testmodus)"};var aZ=BM;function GM(e){return!aZ(e.status)&&e.voidRequestedAt===void 0}s(GM,"holdsContract");async function zM(e,n){return await e.db.query("legal_entities").withIndex("by_partyId",t=>t.eq("partyId",n)).unique()}s(zM,"traegerLegalEntityOfParty");async function lZ(e,n){return await e.db.query("organizations").withIndex("by_partyId",r=>r.eq("partyId",n)).first()!==null}s(lZ,"isOrganizationParty");async function WM(e,n){return await zM(e,n)!==null?"traeger":await lZ(e,n)?"organization":"person"}s(WM,"signerKindOf");async function YM(e,n){n.length===0&&F("signingSideOf: a Vorgang without signers asks nobody");for(let t of n)if(await dZ(e,t.partyId)==="family")return"family";return"traeger"}s(YM,"signingSideOf");async function dZ(e,n){return await WM(e,n)==="traeger"?"traeger":"family"}s(dZ,"sideOfParty");var pFe=m.object({key:m.string(),name:m.object({de:m.string(),en:m.string()}),billingItemDefinitionIds:m.array(m.id("billing_item_definitions"))}),JM=m.object({key:m.string(),name:m.object({de:m.string(),en:m.string()})});var Yx=m.union(m.literal("month"),m.literal("year"),m.literal("once"),m.literal("unit")),_h=m.object({period:Yx,anchorDate:m.string()});var wFe=m.union(m.object({percent:m.number()}),m.object({amountMinor:m.number()})),kFe=m.union(m.literal("line"),m.literal("aggregate")),Ph=m.record(m.string(),m.string());var cZ=m.union(m.literal("active"),m.literal("ended")),Hx=m.union(m.object({mode:m.literal("track")}),m.object({mode:m.literal("pin"),billingItemVersionId:Ue.restrict(m.id("billing_item_versions"),{unindexed:"pinned price version inside the pricing union"})}),m.object({mode:m.literal("override"),amount:m.number()})),uZ=m.union(m.object({anchor:m.literal("enrollment")}),m.object({anchor:m.literal("manual"),activeFrom:m.string(),activeTo:m.optional(m.string())})),fZ={contractId:Ue.belongsTo(m.id("contracts")),billingItemDefinitionId:Ue.restrict(m.id("billing_item_definitions")),pricing:Hx,pricingSelections:m.optional(Ph),paymentSchedule:m.optional(_h),resolvedSnapshot:m.any(),feeGroup:m.optional(JM),generationRunId:m.optional(Ue.history(m.id("contract_generation_runs")))},pZ={...fZ,period:uZ,enrollmentPeriodBaseline:m.optional(m.string()),enrollmentReconciliations:m.optional(m.record(m.string(),m.object({basis:m.string(),evidence:m.string()}))),status:cZ,enrollmentContextId:m.optional(Ue.restrict(m.id("enrollments")))},RFe=Kt(pZ).index("by_contractId",["contractId"]).index("by_billingItemDefinitionId",["billingItemDefinitionId"]).index("by_enrollmentContextId",["enrollmentContextId"]).index("by_contractId_and_status",["contractId","status"]);var Pr=m.union(m.string(),m.null()),QM=m.object({partyId:m.id("parties"),role:m.string(),nameAtSigning:m.string()}),mZ=m.object({partyId:m.id("parties"),role:m.string(),nameAtSigning:m.string(),representative:m.optional(m.object({userId:m.id("users"),nameAtSigning:m.string(),email:m.string()}))}),ZM=m.object({sourceAllocationId:m.id("payer_allocations"),scope:m.union(m.object({kind:m.literal("contract")}),m.object({kind:m.literal("contract_line"),contractLineId:m.id("contract_lines")})),payer:m.union(m.object({kind:m.literal("party"),partyId:m.id("parties"),nameAtSigning:m.string()}),m.object({kind:m.literal("payment_method"),paymentMethodId:m.id("payment_methods"),label:m.string(),ownersAtSigning:m.array(QM)})),sharePct:m.union(m.number(),m.null()),flatAmount:m.union(m.number(),m.null()),cap:m.union(m.number(),m.null()),activeFrom:m.string(),activeTo:Pr}),XM=m.object({sourceAppliedGrantId:m.string(),sourceGrantTemplateId:m.union(m.string(),m.null()),name:m.string(),reason:m.string(),kind:m.string(),value:m.number(),rule:m.optional(m.any()),scope:m.optional(m.union(m.literal("line"),m.literal("aggregate"))),floorTotal:m.optional(m.number()),pricePeriod:m.optional(Yx),eligibleBillingItemDefinitionIds:m.optional(m.array(m.id("billing_item_definitions"))),eligibleContractLineIds:m.optional(m.array(m.id("contract_lines"))),activeFrom:m.string(),activeTo:Pr,status:m.string(),qualifyingEnrolmentId:m.union(m.id("enrollments"),m.null()),eligibilityRuleOpaque:m.any(),eligibilityEvidenceOpaque:m.any()}),hZ={sourceContractLineId:m.id("contract_lines"),status:m.string(),activeFrom:m.string(),activeTo:Pr,pricing:Hx,paymentSchedule:m.optional(_h),pricingSelections:m.optional(Ph),billingItemDefinition:m.object({sourceBillingItemDefinitionId:m.id("billing_item_definitions"),name:m.string(),itemType:m.string(),configOpaque:m.any()}),resolvedSnapshotOpaque:m.any(),enrolment:m.union(m.object({sourceEnrolmentId:m.id("enrollments"),status:m.string(),startDate:Pr,endDate:Pr,studentPartyId:m.id("parties"),studentNameAtSigning:m.string(),unitName:Pr,programName:Pr,runName:Pr,groupName:Pr}),m.null()),grants:m.array(XM),payerAllocations:m.array(ZM)},gZ=m.object({...hZ,resolvedPrice:m.object({amount:m.number(),currency:m.string(),sourceBillingItemVersionId:m.union(m.id("billing_item_versions"),m.null()),sourceValidFrom:Pr,sourceValidTo:Pr})}),yZ=m.object({formatVersion:m.literal(2),contract:m.object({scope:m.string(),generator:m.object({sourceGeneratorDefinitionId:m.id("contract_generator_definitions"),sourceCreationTime:m.number(),name:m.string(),bodyOpaque:m.any()})}),parties:m.array(QM),declaredSigners:m.array(mZ),payerAllocations:m.array(ZM),aggregateGrants:m.optional(m.array(XM)),lines:m.array(gZ)}),wZ=yZ;var kZ=m.object({left:m.number(),top:m.number(),width:m.number(),height:m.number()}),bZ=m.object({pageCount:m.number(),spots:m.array(m.object({signer:m.union(m.object({kind:m.literal("party"),role:m.string(),ordinal:m.union(m.number(),m.null())}),m.object({kind:m.literal("named"),label:$i})),caption:m.string(),page:m.number(),box:kZ}))});var vZ=m.object({storageId:Ue.holds(m.id("_storage")),sourceArtifactId:m.optional(Ue.history(m.id("admission_documents"))),sha256:m.string(),mimeType:m.optional(m.string()),sizeBytes:m.optional(m.number()),filename:m.string(),source:m.union(m.object({kind:m.literal("uploaded")}),m.object({kind:m.literal("machine_rendered"),rendererVersion:m.string(),renderInput:m.record(m.string(),m.any()),signaturePlacement:m.optional(bZ)}))}),xZ=m.object({storageId:Ue.holds(m.id("_storage")),sha256:m.string(),filename:m.string(),rendererVersion:m.string(),renderInput:m.record(m.string(),m.any()),confirmationRequired:m.boolean()}),SZ={importedTemplateSource:m.optional(m.object({id:m.string(),creationTime:m.number()})),tenantId:Ue.tenant(m.id("tenants")),contractId:Ue.restrict(m.id("contracts")),snapshotNumber:m.optional(m.number()),revisionNumber:m.optional(m.number()),supersedesSnapshotId:m.optional(Ue.history(m.id("contract_snapshots"))),frozenAt:m.number(),frozenByUserId:m.optional(Ue.history(m.id("users"))),document:vZ,coverLetter:m.optional(xZ),snapshot:Ue.historyOf(wZ),generation:m.optional(m.object({generatorVersionId:m.optional(Ue.history(m.id("contract_generator_versions"))),generatorRevisionId:m.optional(m.string()),implementationKey:m.string(),implementationChecksum:m.string(),input:m.any(),output:m.any()}))},FFe=Kt(SZ).index("by_tenantId",["tenantId"]).index("by_document_storageId",["document.storageId"]).index("by_coverLetter_storageId",["coverLetter.storageId"]).index("by_contractId_and_snapshotNumber",["contractId","snapshotNumber"]).index("by_supersedesSnapshotId",["supersedesSnapshotId"]).index("by_generation_generatorVersionId",["generation.generatorVersionId"]);var JFe=16*1024;var QFe=15*6e4;var ZFe=10*6e4;var Jx={contractSnapshotId:Ue.restrict(m.id("contract_snapshots")),storageId:Ue.restrict(m.id("_storage")),sha256:m.string(),filename:m.string(),uploadedAt:m.number(),signers:m.array(m.object({partyId:Ue.history(m.id("parties")),role:m.string()}))},hLe=Kt({tenantId:Ue.tenant(m.id("tenants")),signingRequestDocumentId:Ue.belongsTo(m.id("signing_request_documents")),...Jx}).index("by_tenantId",["tenantId"]).index("by_signingRequestDocumentId",["signingRequestDocumentId"]).index("by_contractSnapshotId",["contractSnapshotId"]).index("by_storageId",["storageId"]);var bLe=m.object(Jx);var Qx=200;async function AZ(e,n,t,r){n.length>Qx&&F(`${r} is carried by more than ${Qx} signing requests`);let i=[],o=new Set;for(let l of n){if(o.has(l.signingRequestId))continue;o.add(l.signingRequestId);let d=await e.db.get(l.signingRequestId);d===null&&F(`signing_request_documents ${l._id} names a missing signing request ${l.signingRequestId}`),i.push(d)}let a=t==="asc"?1:-1;return i.sort((l,d)=>a*(l._creationTime-d._creationTime))}s(AZ,"requestsOfMembers");async function eq(e,n,t="asc"){let r=await e.db.query("signing_request_documents").withIndex("by_contractSnapshotId",i=>i.eq("contractSnapshotId",n)).take(Qx+1);return await AZ(e,r,t,`revision ${n}`)}s(eq,"requestsOfSnapshot");var nq=100;async function EZ(e,n){let t=await eq(e,n);t.length>nq&&F(`requestsBySideOf: revision ${n} has more than ${nq} Vorg\xE4nge`);let r={family:[],traeger:[]};for(let i of t.sort((o,a)=>o._creationTime-a._creationTime))r[await YM(e,i.signers)].push(i);return r}s(EZ,"requestsBySideOf");async function Zx(e,n){return(await EZ(e,n)).family}s(Zx,"familyRequestsOf");var Xx=100;async function TZ(e,n){let t=await e;return t.length>Xx&&F(`contractChain: more than ${Xx} ${n}`),t}s(TZ,"bounded");async function RZ(e,n,t){let r=await Oh(e,{applicationId:n,nodeId:t,key:Rp});return r.state==="pending"?null:(r.ref.kind!=="contract"&&F(`contractChain: $node.${t}.${Rp} of application ${n} is a ${r.ref.kind} ref \u2014 the contract chain writes a contract ref`),r.ref.contractId)}s(RZ,"nodeContractRef");async function tq(e,n){return await TZ(e.db.query("contract_snapshots").withIndex("by_contractId_and_snapshotNumber",t=>t.eq("contractId",n)).take(Xx+1),`revisions on contract ${n}`)}s(tq,"snapshotsAsc");async function eS(e,n){let t=(await Zx(e,n)).filter(GM);return t.length>1&&F(`contractChain: revision ${n} has ${t.length} open family Vorg\xE4nge`),t[0]??null}s(eS,"openFamilyRequest");async function $Z(e,n){for(let t of await tq(e,n))if((await Zx(e,t._id)).some(r=>r.provider==="manual"))return"paper";return"provider"}s($Z,"familyRoute");async function rq(e,n){for(let t of n)if(await $Z(e,t)==="paper")return"paper";return"provider"}s(rq,"familyRouteOf");async function IZ(e,n){let t=await jM(e,n._id),r=await e.db.system.get("_storage",t.storageId);return r===null&&F(`contractChain: return ${n._id} holds missing file ${t.storageId}`),{_id:n._id,_creationTime:n._creationTime,storageId:t.storageId,filename:t.filename,...r.contentType!==void 0?{mimeType:r.contentType}:{},round:n._id}}s(IZ,"toReturn");function Nh(e){async function n(a,l){return await RZ(a,l,e.id)}s(n,"contractOrNull");async function t(a,l,d,c){let u=a.db.normalizeId("contract_snapshots",d),p=u===null?null:await a.db.get(u),h=await n(a,l);return(p===null||h===null||p.contractId!==h)&&F(`${c}: ${d} is no revision of node "${e.id}"'s contract ${h??"(none yet)"} \u2014 corrupt arc`),p}s(t,"snapshotOf");async function r(a,l){let d=await n(a,l);return d===null?null:(await tq(a,d)).at(-1)??null}return s(r,"newestSnapshot"),{reads:{kind:"contract",async returned(a,l,d){if(d.askedAbout===void 0){if(d.onUnpinned==="notReturned")return null;F(`returned(${d.where}): an ask of the contract chain is always pinned to its revision`)}let c=await t(a,l,d.askedAbout,`returned(${d.where})`),u=await eS(a,c._id);if(u===null)return null;let p=(await $h(a,u._id)).filter(h=>h.review.status==="pending"&&h._id!==d.rejected);return p.length>1&&F(`returned(${d.where}): Vorgang ${u._id} has ${p.length} returns pending \u2014 one is checked at a time`),p[0]===void 0?null:await IZ(a,p[0])},pinOf(a){return a.contractSnapshotId},returnPinOf(a){return a.signingReturnId}},contractOrNull:n,snapshotOf:t,newestSnapshot:r,contractsOf:{async contractsOf(a,l){let d=await n(a,l);return d===null?[]:[d]}}.contractsOf}}s(Nh,"contractNodeReads");function Ch(e){return e.addedParts??[]}s(Ch,"addedPartsOf");var nS=50;async function OZ(e,n){let t=await e.db.query("contract_generation_runs").withIndex("by_packageRunId",r=>r.eq("packageRunId",n)).take(nS+1);return t.length>nS&&F(`groupRunsOf: generation group ${n} has more than ${nS} runs`),t.length===0&&F(`groupRunsOf: generation group ${n} has no run`),t.sort((r,i)=>r._creationTime-i._creationTime)}s(OZ,"groupRunsOf");async function iq(e,n){let t=await OZ(e,n),r=t[0].packageRunId;if(r!==void 0){(t.some(l=>l.packageRunId!==r||l.partKey===void 0)||new Set(t.map(l=>l.partKey)).size!==t.length)&&F(`groupRunsInOrder: package group ${n} has inconsistent members`);let i=await e.db.get(r);i===null&&F(`groupRunsInOrder: package run ${n} is missing`);let o=await e.db.query("contract_package_parts").withIndex("by_packageVersionId_and_position",l=>l.eq("packageVersionId",i.packageVersionId)).take(51),a=[...o.map(l=>l.partKey),...Ch(i).map(l=>l.partKey)];return(o.length>50||t.some(l=>!a.includes(l.partKey)))&&F(`groupRunsInOrder: package group ${n} names an unknown part`),t.sort((l,d)=>a.indexOf(l.partKey)-a.indexOf(d.partKey))}F(`Package run ${n} has no package reference.`)}s(iq,"groupRunsInOrder");function oq(e){return e.every(n=>n.status==="succeeded"&&n.contractId!==void 0&&n.contractSnapshotId!==void 0)}s(oq,"isCompleteGroup");var tS=200;function _Z(e){let n=e.generatorStamp?.parts;return n===void 0&&F(`groupChain: node "${e.id}" names no combined generator \u2014 only a combined generator keeps a group chain`),n.map(t=>t.partKey)}s(_Z,"groupPartKeys");async function PZ(e,n,t){let r=await e.db.query("contract_generation_runs").withIndex("by_applicationId_and_workflowNodeId",i=>i.eq("applicationId",n).eq("workflowNodeId",t)).take(tS+1);return r.length>tS&&F(`groupChain: more than ${tS} generation runs on node ${t}`),r}s(PZ,"nodeRuns");async function NZ(e,n,t){let r=_Z(t),i=new Set;for(let a of await PZ(e,n,t.id))a.packageRunId===void 0&&F(`groupChain: run ${a._id} on the combined node "${t.id}" carries no generation group`),i.add(a.packageRunId);let o=[];for(let a of i){let l=await iq(e,a);if(!oq(l))continue;let d=await e.db.get(a);d===null&&F(`groupChain: generation group ${a} has no package run`);let c=new Set(Ch(d).map(p=>p.partKey)),u=[];for(let p of l){!r.includes(p.partKey)&&!c.has(p.partKey)&&F(`groupChain: run ${p._id} renders part "${p.partKey}", which node "${t.id}"'s pin does not declare and nobody added`);let h=await e.db.get(p.contractSnapshotId);h===null&&F(`groupChain: run ${p._id} names revision ${p.contractSnapshotId}, which is gone \u2014 a deleted draft lets its run go first`),u.push({run:p,snapshot:h})}o.push({packageRunId:a,startedAt:Math.min(...l.map(p=>p._creationTime)),members:u})}return o.sort((a,l)=>a.startedAt-l.startedAt)}s(NZ,"groupRevisionRows");async function rS(e,n,t){let r=await Oh(e,{applicationId:n,nodeId:t,key:$p});return r.state==="pending"?[]:(r.ref.kind!=="contracts"&&F(`groupChain: $node.${t}.${$p} of application ${n} is a ${r.ref.kind} ref \u2014 the group chain writes a contracts ref`),[...r.ref.contracts])}s(rS,"nodeGroupContracts");async function CZ(e,n){let t=new Map;for(let{snapshot:r}of n.members){let i=await eS(e,r._id);i!==null&&t.set(i._id,i)}return t.size>1&&F(`groupChain: generation group ${n.packageRunId} is held by ${t.size} family Vorg\xE4nge \u2014 one Vorgang carries the group`),[...t.values()][0]??null}s(CZ,"openGroupRequest");async function DZ(e,n){let t=[];for(let i of await Gx(e,n._id)){let o=await e.db.system.get("_storage",i.storageId);o===null&&F(`groupChain: return ${n._id} holds missing file ${i.storageId}`),t.push({contractSnapshotId:i.contractSnapshotId,storageId:i.storageId,filename:i.filename,...o.contentType!==void 0?{mimeType:o.contentType}:{}})}let r=t[0];return{_id:n._id,_creationTime:n._creationTime,storageId:r.storageId,filename:r.filename,...r.mimeType!==void 0?{mimeType:r.mimeType}:{},round:n._id,documents:t}}s(DZ,"toGroupReturn");function sq(e){async function n(i,o,a,l){let d=(await NZ(i,o,e)).find(c=>c.members[0]?.snapshot._id===a);return d===void 0&&F(`${l}: ${a} is no revision of node "${e.id}"'s generation groups \u2014 corrupt arc`),d}return s(n,"revisionRowOf"),{reads:{kind:"group",async returned(i,o,a){if(a.askedAbout===void 0){if(a.onUnpinned==="notReturned")return null;F(`returned(${a.where}): an ask of the group chain is always pinned to its lead revision`)}let l=await n(i,o,a.askedAbout,`returned(${a.where})`),d=await CZ(i,l);if(d===null)return null;let c=(await $h(i,d._id)).filter(u=>u.review.status==="pending"&&u._id!==a.rejected);return c.length>1&&F(`returned(${a.where}): Vorgang ${d._id} has ${c.length} returns pending \u2014 one is checked at a time`),c[0]===void 0?null:await DZ(i,c[0])},pinOf(i){return i.contractSnapshotId},returnPinOf(i){return i.signingReturnId}},revisionRowOf:n,contractsOf:{async contractsOf(i,o){return(await rS(i,o,e.id)).map(a=>a.contractId)}}.contractsOf}}s(sq,"groupNodeReads");async function FZ(e,n){let t=n.lifecycle.kind==="draft"?void 0:n.lifecycle.kind;return{_id:n._id,_creationTime:n._creationTime,versionNumber:n.versionNumber,...t!==void 0?{status:t}:{},origin:n.origin.kind,storageId:n.storageId,...await Ub(e,n.storageId),...n.filename!==void 0?{filename:n.filename}:{}}}s(FZ,"toRevision");async function LZ(e,n){let t=await FZ(e,n);return{_id:t._id,_creationTime:t._creationTime,storageId:t.storageId,...t.filename!==void 0?{filename:t.filename}:{},...t.mimeType!==void 0?{mimeType:t.mimeType}:{},round:t.versionNumber}}s(LZ,"toReturn");function aq(e){let n=Om(e);async function t(o,a){return await o.db.query("admission_documents").withIndex("by_applicationId_and_slotKey_and_versionNumber",l=>l.eq("applicationId",a).eq("slotKey",n)).collect()}return s(t,"contentRowsAsc"),{reads:{kind:"artifact",async returned(o,a,l){if(l.askedAbout===void 0){if(l.onUnpinned==="notReturned")return null;ae("CONFLICT",{de:"Die offene Antwort-Aufgabe ist an keine Dokumentversion gebunden, daher l\xE4sst sich die unterschriebene Fassung nicht vom versandten Dokument unterscheiden. Stellen Sie das Dokument neu aus (Zur\xFCckziehen & neu ausstellen).",en:"The open response task is not bound to a document version, so the signed copy cannot be told apart from the document that was sent. Issue the document again (withdraw and reissue)."})}let d=await t(o,a),c=d[d.length-1];if(c===void 0||c._id===l.askedAbout||c.origin.kind!=="uploaded")return null;if(l.rejected!==void 0){let u=d.find(p=>p._id===l.rejected);if(u===void 0&&F(`returned(${l.where}): the handed-back scan ${l.rejected} is no version of slot "${n}"`),c.versionNumber<=u.versionNumber)return null}return await LZ(o,c)},pinOf(o){return o.artifactVersionId},returnPinOf(o){return o.artifactVersionId}},contentRowsAsc:t,contractsOf:{async contractsOf(){return[]}}.contractsOf}}s(aq,"artifactNodeReads");function Dh(e){return e.production==="none"&&F(`documentChainKind: node "${e.id}" has production 'none' \u2014 it keeps no document`),e.production!=="resolver"?"artifact":e.generatorStamp?.parts!==void 0?"group":"contract"}s(Dh,"documentChainKind");function lq(e){switch(Dh(e)){case"contract":return Nh(e).reads;case"group":return sq(e).reads;case"artifact":return aq(e).reads}}s(lq,"documentReadsFor");var MZ={de:"Haben Sie die Vertragsbedingungen gelesen und verstanden?",en:"Have you read and understood the contract terms?"};function yc(e){let n=e.responseStrategy;return typeof n=="string"&&n in Ai?Ai[n].producesResponseArtifact:!1}s(yc,"returnsSignedCopy");function qZ(e){return yc(e)&&e.confirmContractTerms!==!1}s(qZ,"asksContractTerms");function dq(e){return qZ(e)?{title:e.contractTermsQuestionText??MZ,body:{de:"Die unterschriebene Fassung wird erst nach Ihrer Best\xE4tigung hochgeladen. Die Best\xE4tigung wird mit Zeitpunkt und Person festgehalten.",en:"The signed copy is uploaded only after you confirm. The confirmation is recorded with time and person."},confirmLabel:{de:"OK",en:"OK"}}:null}s(dq,"contractTermsConfirm");function cq(e){let n=KZ(e);return n.length>0&&n.every(t=>t.status==="blocked")}s(cq,"producerWindowHeld");function KZ(e){return e.filter(n=>n.isOpen&&n.kind==="admission"&&n.templateKey!==void 0&&bd.has(n.templateKey))}s(KZ,"openProducerRows");async function jZ(e,n,t){if(t.revisesWorkItemId===void 0)return;let r=await e.db.get(t.revisesWorkItemId),i=r===null?null:Ok(r),o=i?.context,a=o?.kind==="admission"?n.returnPinOf(o):void 0;return(i===null||o===void 0||o.kind!=="admission"||i.templateKey!==ri||i.status!=="done"||i.outcome!=="rejected"||a===void 0)&&F(`rejectedReturnOfAsk: ask ${t._id} revises ${t.revisesWorkItemId}, which is not a rejected, pinned ${ri} row`),a}s(jZ,"rejectedReturnOfAsk");async function uq(e,n){return await n.chain.returned(e,n.applicationId,{askedAbout:n.chain.pinOf(n.ask),rejected:await jZ(e,n.chain,n.ask),onUnpinned:n.onUnpinned,where:n.where})}s(uq,"returnedCopyOfAsk");var iS=new Set([...bd,Ir,ns,co,ri,ft]),gq={id:Qn,type:"contractGenerator",label:{de:"Vertragsgenerator",en:"Contract generator"},required:!0,inspector:"literal-only",optionSource:"tenantGenerators"},yq={id:Lo,type:"documentTemplate",label:{de:"Dokumentvorlage",en:"Document template"},required:!0,inspector:"literal-only",optionSource:"tenantDocumentTemplates"};function VZ(e){let n=[],t=[{slot:gq,production:"resolver",de:{a:"einen",the:"der",it:"ihn"}},{slot:yq,production:"template",de:{a:"eine",the:"die",it:"sie"}}];for(let{slot:r,production:i,de:o}of t){let a=e.inputs?.[r.id];if(a===void 0||a.kind==="unset")continue;let l=`inputs.${r.id}`;if(e.production!==i){n.push(Se(e,l,{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', nennt aber ${o.a} ${r.label.de} \u2014 nur production '${i}' verwendet sie.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but names a ${r.label.en.toLowerCase()} \u2014 only production '${i}' uses it.`}));continue}if(a.kind==="binding"){n.push(Se(e,l,{de:`[governedDocument/referenceNotLiteral] Knoten "${e.id}": ${o.the} ${r.label.de} ist ein fester Wert des Knotens, keine Bindung \u2014 w\xE4hlen Sie ${o.it} aus.`,en:`[governedDocument/referenceNotLiteral] Node "${e.id}": the ${r.label.en.toLowerCase()} is a fixed value of the node, not a binding \u2014 choose it from the list.`}));continue}if(a.kind!=="literal")continue;let d=Xl(a.value,{type:r.type});d!==null&&n.push(Se(e,l,{de:`[governedDocument/referenceShape] Knoten "${e.id}": ${d}.`,en:`[governedDocument/referenceShape] Node "${e.id}": ${d}.`}))}return n}s(VZ,"referenceInputIssues");var BZ={id:Si,type:"number",label:{de:"Antwortfrist (Tage)",en:"Answer within (days)"},inspector:"literal-only"},UZ={id:Ca,type:"boolean",label:{de:"Anschreiben best\xE4tigen lassen",en:"Have the cover letter confirmed"},inspector:"literal-only"},GZ={id:Bt,type:"legalEntity",label:uD,required:!0,inspector:"literal-only",optionSource:"tenantTraeger"};function zZ(e,n){let t=`inputs.${Bt}`,r=e.inputs?.[Bt];if(r!==void 0&&r.kind==="binding")return[Se(e,t,{de:`[governedDocument/traegerNotLiteral] Knoten "${e.id}": der Tr\xE4ger ist ein fester Wert des Knotens, keine Bindung \u2014 w\xE4hlen Sie ihn aus.`,en:`[governedDocument/traegerNotLiteral] Node "${e.id}": the legal entity is a fixed value of the node, not a binding \u2014 choose it from the list.`})];let i=Na(e),o=n?.resolverPrintsTraegerAddress?.get(e.id)??new Set,a=[];for(let l of new Set([...i===null?[]:[i],...o])){let d=n?.traeger?.get(l);n?.traeger!==void 0&&d===void 0?a.push(Se(e,t,{de:`[governedDocument/unknownTraeger] Knoten "${e.id}" nennt den Tr\xE4ger "${l}", den es in diesem Mandanten nicht gibt \u2014 bekannt: ${[...n.traeger.keys()].join(", ")||"(keiner)"}.`,en:`[governedDocument/unknownTraeger] Node "${e.id}" names the legal entity "${l}", which does not exist in this school \u2014 known: ${[...n.traeger.keys()].join(", ")||"(none)"}.`})):d!==void 0&&!d.hasAddress&&o.has(l)&&a.push(Se(e,t,{de:`[governedDocument/traegerAddressMissing] Die Vorlage des Generators an Knoten "${e.id}" druckt die Anschrift des Tr\xE4gers (${km.address}), aber "${l}" hat keine \u2014 in der Konfiguration des Mandanten nachtragen (foundation.legalEntities[].address).`,en:`[governedDocument/traegerAddressMissing] The generator template on node "${e.id}" prints the legal entity's address (${km.address}), but "${l}" has none \u2014 add it in the school's configuration (foundation.legalEntities[].address).`}))}return a}s(zZ,"traegerIssues");function Fh(e){if(e.production==="template"){let t=e.templateStamp?.fields;return Array.isArray(t)?t:[]}if(e.production!=="resolver")return[];let n=e.generatorStamp?.inputSchema?.fields;return Array.isArray(n)?n.map(t=>{let{label:r}=t;return r===void 0?{...t,label:{de:t.key,en:t.key}}:(zi(r)||F(`governedDocument "${e.id}": the stamped generator parameter "${t.key}" has no { de, en } label (${JSON.stringify(r)}) \u2014 rebuild local fixtures or obtain a reviewed repair of this retained workflow stamp.`),{...t,label:r})}):[]}s(Fh,"generatorFields");function WZ(e,n){return e.inputs?.[n]?.kind==="cockpit"}s(WZ,"deferredToCockpit");function YZ(e){return Xi(e.type)?e.type:void 0}s(YZ,"resolverSlotType");function HZ(e){if(e.confirmBeforeIssue!==!0||e.approval!=="none")return null;let n=La(e);return{confirm:{title:{de:`\u201E${n.de}\u201C jetzt senden?`,en:`Send "${n.en}" now?`},body:{de:"Das Dokument wird danach f\xFCr die Familie sichtbar.",en:"The family will be able to see the document afterwards."},confirmLabel:{de:"Senden",en:"Send"}}}}s(HZ,"issueConfirmation");function Se(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(Se,"issue");function Lh(e){return Em.includes(e.production)&&ss.includes(e.approval)&&Rm.includes(e.responseStrategy)}s(Lh,"hasValidModes");async function oS(e,n){let t=await va(e,{applicationId:n.applicationId,nodeId:n.node.id});if(t.length===0)return"pending";let r=t.filter(a=>a.isOpen&&a.kind==="admission");if(cq(r))return"producingHeld";if(r.some(a=>a.templateKey!==void 0&&bd.has(a.templateKey)))return"producing";if(r.some(a=>a.templateKey===co))return"awaitingCoverLetter";let i=r.find(a=>a.templateKey===Ir);if(i!==void 0)return i.status==="blocked"?"deferred":"awaitingApproval";if(r.some(a=>a.templateKey===ft))return"signatureStalled";let o=r.find(a=>a.templateKey===ns);if(o!==void 0){if(Ei(n.node).issuesBy==="provider"){let l=Dh(n.node)==="group"?(await rS(e,n.applicationId,n.node.id)).map(d=>d.contractId):[await Nh(n.node).contractOrNull(e,n.applicationId)].flatMap(d=>d===null?[]:[d]);if(l.length===0&&F(`governedDocCurrentState: eSignature node "${n.node.id}" has an open ask but no contract`),await rq(e,l)==="provider")return"awaitingSignature"}return Ei(n.node).producesResponseArtifact?await uq(e,{chain:lq(n.node),applicationId:n.applicationId,ask:o,onUnpinned:"notReturned",where:`governedDocCurrentState(node "${n.node.id}")`})===null?"awaitingResponse":"responseReturned":"awaitingResponse"}return r.some(a=>a.templateKey===ri)?"responseInCheck":"done"}s(oS,"governedDocCurrentState");function fq(e){return e.production!=="none"&&Dh(e)!=="artifact"}s(fq,"keepsDocumentInContractDomain");function JZ(e,n){let t=e.inputs?.[n.key];if(t?.kind!=="binding")return[];let r=t.address;if(!we(r)||r.scope!=="env"||!tr(r.key))return[];let i=Fo(r.key);if(n.type!==i.type)return[Se(e,`inputs.${n.key}`,{de:`[governedDocument/envNotCovered] Feld "${n.key}" ist ${n.type}, die Umgebungsvariable \u201E${i.label.de}\u201C (${de(r)}) liefert ${i.type}.`,en:`[governedDocument/envNotCovered] Field "${n.key}" is ${n.type}, the environment variable "${i.label.en}" (${de(r)}) supplies ${i.type}.`})];let o=new Set((n.options??[]).map(l=>l.value)),a=(i.enumOptions??[]).filter(l=>!o.has(l.value));return a.length===0?[]:[Se(e,`inputs.${n.key}`,{de:`[governedDocument/envNotCovered] Feld "${n.key}" kennt ${a.map(l=>`\u201E${l.label.de}\u201C (${l.value})`).join(", ")} nicht \u2014 die Umgebungsvariable \u201E${i.label.de}\u201C kann diese Werte liefern. Jeder Wert braucht eine Option.`,en:`[governedDocument/envNotCovered] Field "${n.key}" does not know ${a.map(l=>`"${l.label.en}" (${l.value})`).join(", ")} \u2014 the environment variable "${i.label.en}" can supply these values. Every value needs an option.`})]}s(JZ,"envCoverageIssues");function wq(e,n){let t=[];for(let r of Fh(e)){if(r.type==="party"||r.type==="personList")continue;if(t.push(...JZ(e,r)),r.processSource!==void 0){let a=e.inputs?.[r.key],l=a?.kind==="binding"?{de:`eine Bindung an ${we(a.address)?de(a.address):JSON.stringify(a.address)}`,en:`a binding to ${we(a.address)?de(a.address):JSON.stringify(a.address)}`}:a?.kind==="literal"?{de:"ein fester Wert",en:"a fixed value"}:WZ(e,r.key)?{de:"eine Erg\xE4nzung im Cockpit",en:"a completion in the cockpit"}:null;l!==null&&t.push({layer:"GRAPH",kind:"contractGap",path:`nodes.${e.id}.inputs.${r.key}`,reason:{de:`[governedDocument/processSourceConflict] "${r.label.de}" wird vom Vorgang selbst gef\xFCllt (${r.processSource}), daneben steht ${l.de}. Eine der beiden Quellen bliebe wirkungslos \u2014 entferne die Verdrahtung.`,en:`[governedDocument/processSourceConflict] "${r.label.en}" is filled by the case itself (${r.processSource}), and ${l.en} is set as well. One of the two sources would have no effect \u2014 remove the wiring.`},severity:"error"});continue}if(r.required!==!0)continue;let i=e.inputs?.[r.key];i?.kind==="binding"||i?.kind==="literal"||i?.kind==="cockpit"||r.defaultValue!==void 0||t.push({layer:"GRAPH",kind:"contractGap",path:`nodes.${e.id}.inputs.${r.key}`,reason:{de:`[governedDocument/unsourcedRequiredField] Pflichtfeld "${r.label.de}" des Generators ${n.de} hat keine Quelle \u2014 binde es an ein Formular-Export-Feld, setze einen festen Wert oder lass es ausdr\xFCcklich im Cockpit erg\xE4nzen.`,en:`[governedDocument/unsourcedRequiredField] Required field "${r.label.en}" of the generator ${n.en} has no source \u2014 bind it to a form export field, set a fixed value or leave it explicitly to the cockpit.`},severity:"error"})}return t}s(wq,"fieldSourceIssues");function QZ(e){let n=Er(e)??"\u2014";if(e.templateStamp===void 0)return[];let t=qM(e.templateStamp,n).map(({path:r,reason:i})=>Se(e,r===""?"templateStamp":`templateStamp.${r}`,i));return t.push(...wq(e,{de:`Vorlage "${n}"`,en:`template "${n}"`})),t}s(QZ,"templateIssues");function ZZ(e,n){return(n?.resolverDocumentAnchors?.get(e.id)??[]).flatMap(t=>{if(t.documentAnchors===null)return[Se(e,"resolver",{de:`[governedDocument/eSignatureAnchorMissing] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, aber die Vorlage des Generators "${t.pin}" wurde nie auf Unterschriftsanker gelesen \u2014 Vorlage neu hochladen und den Generator neu versiegeln.`,en:`[governedDocument/eSignatureAnchorMissing] Node "${e.id}" is signed electronically, but the generator template "${t.pin}" was never read for signature anchors \u2014 upload the template again and seal the generator again.`})];let r=t.signerAnchors.filter(i=>!t.documentAnchors.has(i));return r.length===0?[]:[Se(e,"resolver",{de:`[governedDocument/eSignatureAnchorMissing] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, aber die Vorlage von "${t.pin}" tr\xE4gt keinen Anker f\xFCr ${r.map(i=>`/unterschrift:${i}/`).join(", ")} \u2014 der Anbieter f\xE4nde f\xFCr diese Personen kein Unterschriftsfeld.`,en:`[governedDocument/eSignatureAnchorMissing] Node "${e.id}" is signed electronically, but the template of "${t.pin}" has no anchor for ${r.map(i=>`/unterschrift:${i}/`).join(", ")} \u2014 the provider would find no signature field for these people.`})]})}s(ZZ,"eSignatureAnchorIssues");function XZ(e,n){return n===void 0||n.sendable?[]:Ei(e).issuesBy!=="provider"?[]:[Se(e,"responseStrategy",{de:`[signing/noActiveProvider] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, aber die Schule kann nicht senden: ${n.reason.de}`,en:`[signing/noActiveProvider] Node "${e.id}" is signed electronically, but the school cannot send: ${n.reason.en}`})]}s(XZ,"eSignatureProviderIssues");var pq={key:"dokument",label:te("Dokument","Document"),scope:"node"},mq={producing:{label:te("Dokument in Vorbereitung","Document in preparation"),tone:"blue",phase:pq,external:nn(te("In Vorbereitung","In preparation"),"blue",te("Ihr Dokument wird vorbereitet","Your document is being prepared"),te("Die Schule erstellt Ihr Dokument. Sie erhalten es in K\xFCrze im Portal.","The school is preparing your document. You will receive it in the portal shortly."))},issued:{label:te("Dokument bereitgestellt","Document issued"),tone:"blue",phase:pq,external:nn(te("Dokument bereit","Document ready"),"amber",te("Ihr Dokument liegt bereit","Your document is ready"),te("Bitte beantworten Sie das Dokument innerhalb der Frist. Sie finden es in Ihren Aufgaben.","Please respond to the document within the deadline. You will find it in your tasks."),te("Dokument beantworten","Respond to the document"))}};function hq(e,n){return!Lh(e)||e.production==="none"?null:n===co||Im(e).some(r=>r.key===n)?Om(e):null}s(hq,"governedDocRowSlot");var kq={role:"user-action",effect:"side-effect",processHoldTemplate:s(()=>es,"processHoldTemplate"),progressDefaults:mq,progressEvents:Gn(mq),notificationEvents:s(e=>[{id:"issued",label:{de:"Dokument bereitgestellt",en:"Document issued"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0},{key:"dueInDays",type:"number"}]},{id:"responded",label:{de:"Antwort eingegangen",en:"Response received"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0}]},{id:"coverLetterAsked",label:{de:"Anschreiben zur Best\xE4tigung",en:"Cover letter to confirm"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0},{key:"dueInDays",type:"number",required:!1}]},{id:"responseRejected",label:{de:"R\xFCcklauf zur\xFCckgegeben",en:"Returned copy handed back"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0},{key:"reason",type:"string",required:!0}]}],"notificationEvents"),strictActionCoverage:!0,actions:s(e=>{if(!Lh(e))return[];let n=Ei(e),t=[],r=n.producesResponseArtifact?["awaitingResponse","responseReturned"]:["awaitingResponse"],i=n.issuesBy==="provider"?["awaitingSignature","signatureStalled",...r]:r,o=[...os(e)?["awaitingCoverLetter"]:[],...i,...n.checksReturn?["responseInCheck"]:[]];return e.production!=="none"&&(t.push({id:tb(e),kind:"internal",surface:Da,label:e.approval==="release"?{de:"Freigabe anfordern",en:"Request approval"}:{de:"Bereitstellen",en:"Issue document"},availableIn:["producing","producingHeld"],...e.approval==="release"?{handsTo:Ir}:{},...HZ(e)??{}}),t.push({id:hD,kind:"internal",surface:Da,label:{de:"Korrigieren",en:"Correct"},availableIn:o,superUserOnly:!0},{id:gD,kind:"internal",surface:Da,label:{de:"Zur\xFCckziehen & neu ausstellen",en:"Rescind & re-issue"},availableIn:o,superUserOnly:!0})),t.push(n.checksReturn?{id:xm,kind:"internal",label:e.responseLabels?.accept??n.defaultLabels.accept,availableIn:[r[r.length-1]],external:{emphasis:"primary",event:"documentReturned"}}:{id:n.acceptOutcomeId,kind:"advance",outcome:n.acceptOutcomeId,semantic:n.outcomeSemantics.accept,label:e.responseLabels?.accept??n.defaultLabels.accept,availableIn:[r[r.length-1]],external:{emphasis:"primary",event:"userTaskResolved"}},{id:n.declineOutcomeId,kind:"advance",outcome:n.declineOutcomeId,semantic:n.outcomeSemantics.decline,label:e.responseLabels?.decline??n.defaultLabels.decline,availableIn:os(e)?["awaitingCoverLetter",...i]:i,external:{emphasis:"decline",event:"userTaskResolved"}}),os(e)&&(t.push({id:bm,kind:"internal",label:{de:"Angebot best\xE4tigen",en:"Confirm offer"},availableIn:["awaitingCoverLetter"],external:{emphasis:"primary",event:"coverLetterConfirmed"}}),t.push({id:vm,kind:"internal",label:{de:"\xC4nderung anfordern",en:"Request a change"},availableIn:["awaitingCoverLetter"],external:{emphasis:"secondary",event:"coverLetterRevisionRequested"}})),n.producesResponseArtifact&&t.push({id:Sm,kind:"internal",label:{de:"\xC4nderung anfordern",en:"Request a change"},availableIn:i,external:{emphasis:"secondary",event:"documentChangeRequested"}}),n.issuesBy==="provider"&&t.push({id:Am,kind:"internal",surface:Da,label:{de:"Erneut senden",en:"Send again"},availableIn:["signatureStalled"]},{id:ts,kind:"internal",surface:Da,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}),t},"actions"),states:yD,currentState:oS,workItemTemplates:s(e=>{let n=e;return Lh(n)?Im(n):[]},"workItemTemplates"),taskDocuments:s((e,n)=>{let t=e,r=hq(t,n);return r===null?[]:Im(t).find(o=>o.key===n)?.recipient==="internal"?[{kind:"artifact",key:r}]:[]},"taskDocuments"),taskView:s((e,n)=>{let t=hq(e,n);if(t!==null)return n===co?{kind:"artifact",slot:t,part:"coverLetter"}:{kind:"artifact",slot:t}},"taskView"),inputs:s(e=>[...e.production==="resolver"?[gq,GZ]:[],...e.production==="template"?[yq]:[],BZ,...e.generatorStamp?.coverLetter===!0?[UZ]:[],...Fh(e).filter(n=>n.type!=="party"&&n.type!=="personList").flatMap(n=>{let t=YZ(n);return t===void 0?[]:[{field:n,type:t}]}).map(({field:n,type:t})=>({id:n.key,type:t,label:n.label,required:n.required===!0&&n.processSource===void 0,...n.processSource===void 0?{deferrable:!0}:{},...n.defaultValue!==void 0&&(typeof n.defaultValue=="string"||typeof n.defaultValue=="number"||typeof n.defaultValue=="boolean"||n.defaultValue===null||t==="pricedItem"&&Zi(n.defaultValue))?{defaultValue:n.defaultValue}:{},...n.options!==void 0?{enumOptions:n.options}:{}}))],"inputs"),outputs:s(e=>e.production==="none"?[]:[{name:Vw,type:"documentRef",label:{de:"Dokument",en:"Document"}}],"outputs"),refuseBlocksTarget:s((e,n)=>{if(n===ns||n===co||n===kd||n===ri||n===ft){let t=n===ns?{de:"die Antwort-Aufgabe geh\xF6rt dem Empf\xE4nger",en:"the response task belongs to the recipient"}:n===ri?{de:"die Pr\xFCfung des R\xFCcklaufs entsteht erst mit dem R\xFCcklauf der Familie",en:"the check of the returned copy only arises once the family returns it"}:n===ft?{de:"die Kl\xE4rung der elektronischen Unterschrift entsteht erst, wenn sie nicht zustande kommt",en:"resolving the electronic signature only arises when it does not come about"}:{de:"die \xDCberarbeitungs-Aufgabe entsteht nur durch eine Ablehnung",en:"the revision task only arises from a rejection"};return{de:`[governedDocument/blocksTarget] 'blocks' auf "${n}" (Knoten "${e.id}") ist verboten \u2014 ${t.de}; zul\xE4ssige intrinsische Ziele: ${es}${e.approval==="release"?`, ${Ir}`:""}.`,en:`[governedDocument/blocksTarget] 'blocks' on "${n}" (node "${e.id}") is not allowed \u2014 ${t.en}; allowed intrinsic targets: ${es}${e.approval==="release"?`, ${Ir}`:""}.`}}return n===Ir&&e.approval==="none"?{de:`[governedDocument/blocksTarget] 'blocks' auf "${Ir}" auf Knoten "${e.id}" \u2014 mit approval 'none' existiert dieses Template nicht; der Blocker w\xFCrde ein Phantom aufschieben.`,en:`[governedDocument/blocksTarget] 'blocks' on "${Ir}" on node "${e.id}" \u2014 with approval 'none' this template does not exist; the blocker would postpone a phantom.`}:null},"refuseBlocksTarget"),userUploadGate:s(async(e,n)=>{if(fq(n.node))return!1;let t=await oS(e,n),r=(t==="awaitingResponse"||t==="responseReturned")&&Ei(n.node).producesResponseArtifact;return n.actor==="recipient"?r:t==="producing"&&n.node.production==="upload"||r},"userUploadGate"),userUploadConfirmation:s(async(e,n)=>{let t=dq(n.node);if(t===null||fq(n.node))return null;let r=await oS(e,n);return r==="awaitingResponse"||r==="responseReturned"?t:null},"userUploadConfirmation"),validate:s((e,n,t)=>{let r=[];if(!Lh(e))return r.push(Se(e,"modes",{de:`[governedDocument/unknownMode] Knoten "${e.id}" deklariert keine g\xFCltige Betriebsart \u2014 erforderlich: production \u2208 {${Em.join(", ")}} (ist: ${JSON.stringify(e.production)}), approval \u2208 {${ss.join(", ")}} (ist: ${JSON.stringify(e.approval)}), responseStrategy \u2208 {${Rm.join(", ")}} (ist: ${JSON.stringify(e.responseStrategy)}). Eine Betriebsart ist eine erkl\xE4rte Entscheidung, nie aus der Verdrahtung abgeleitet.`,en:`[governedDocument/unknownMode] Node "${e.id}" declares no valid mode \u2014 required: production \u2208 {${Em.join(", ")}} (is: ${JSON.stringify(e.production)}), approval \u2208 {${ss.join(", ")}} (is: ${JSON.stringify(e.approval)}), responseStrategy \u2208 {${Rm.join(", ")}} (is: ${JSON.stringify(e.responseStrategy)}). A mode is a declared decision, never derived from the wiring.`})),r;let i=Ai[e.responseStrategy];e.production==="none"&&(e.approval!=="none"||e.responseStrategy!=="confirm")&&r.push(Se(e,"production",{de:`[governedDocument/modeContract] Knoten "${e.id}" hat production 'none' \u2014 ohne Dokument gibt es nichts freizugeben und nichts zu unterschreiben: approval muss 'none' sein (ist: '${e.approval}') und responseStrategy 'confirm' (ist: '${e.responseStrategy}').`,en:`[governedDocument/modeContract] Node "${e.id}" has production 'none' \u2014 with no document there is nothing to release and nothing to sign: approval must be 'none' (is: '${e.approval}') and responseStrategy 'confirm' (is: '${e.responseStrategy}').`}));let o=e.artifacts??[];if(e.production==="none")o.length!==0&&r.push(Se(e,"artifacts",{de:`[governedDocument/slotContract] Knoten "${e.id}" hat production 'none', deklariert aber ${o.length} Artefakt-Slot(s) \u2014 ein dokumentloser Best\xE4tigungs-Knoten verwaltet keinen Slot.`,en:`[governedDocument/slotContract] Node "${e.id}" has production 'none' but declares ${o.length} artifact slot(s) \u2014 a confirmation node without a document manages no slot.`}));else{o.length!==1&&r.push(Se(e,"artifacts",{de:`[governedDocument/slotContract] Knoten "${e.id}" deklariert ${o.length} Artefakt-Slots \u2014 genau EINER (das verwaltete Dokument) ist erforderlich.`,en:`[governedDocument/slotContract] Node "${e.id}" declares ${o.length} artifact slots \u2014 exactly ONE (the managed document) is required.`}));for(let T of o)T.visibility!=="external"&&r.push(Se(e,"artifacts",{de:`[governedDocument/slotContract] Slot "${T.key}" auf Knoten "${e.id}" hat visibility "${T.visibility}" \u2014 das verwaltete Dokument MUSS 'external' sein, sonst kann die bewerbende Person es auf /e nie sehen.`,en:`[governedDocument/slotContract] Slot "${T.key}" on node "${e.id}" has visibility "${T.visibility}" \u2014 the managed document MUST be 'external', otherwise the applicant can never see it on /e.`}))}let a=e.outcomes??[],l=a.map(T=>T.id),d=[i.acceptOutcomeId,i.declineOutcomeId];(a.length!==2||!d.every(T=>l.includes(T)))&&r.push(Se(e,"outcomes",{de:`[governedDocument/outcomeContract] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') muss genau ZWEI Outcomes deklarieren \u2014 das Accept-Terminal "${i.acceptOutcomeId}" und das Decline-Terminal "${i.declineOutcomeId}" (deklariert: ${l.length>0?l.map(T=>`"${T}"`).join(", "):"keine"}). Beide sind Pflicht: der Knoten besitzt die Antwort, nicht nur die Freigabe.`,en:`[governedDocument/outcomeContract] Node "${e.id}" (responseStrategy '${e.responseStrategy}') must declare exactly TWO outcomes \u2014 the accept terminal "${i.acceptOutcomeId}" and the decline terminal "${i.declineOutcomeId}" (declared: ${l.length>0?l.map(T=>`"${T}"`).join(", "):"none"}). Both are required: the node owns the answer, not only the release.`}));let c=e.titles,u=s(T=>{let E=c?.[T];return E===null||typeof E!="object"||!Object.values(E??{}).some($=>typeof $=="string"&&$.length>0)},"missingTitle"),p=[];e.production!=="none"&&p.push("prepare","revise"),e.approval==="release"&&p.push("approve"),i.checksReturn&&p.push("check");let h=p.filter(u);h.length>0&&r.push(Se(e,"titles",{de:`[governedDocument/missingTitles] Knoten "${e.id}" fehlen die Aufgaben-Titel ${h.join(", ")} \u2014 der Knotentyp ist dokument-agnostisch, die Betitelung ist Pflicht-Konfiguration seiner Betriebsart.`,en:`[governedDocument/missingTitles] Node "${e.id}" is missing the task titles ${h.join(", ")} \u2014 the node type is document-agnostic, titling is required configuration of its mode.`}));let y=e.assign??{};if(e.production!=="none"&&y.prepareDocument===void 0&&r.push(Se(e,"assign.prepareDocument",{de:`[governedDocument/productionAssign] Knoten "${e.id}" (production '${e.production}') verdrahtet kein Produzenten-Team (assign.prepareDocument) \u2014 ohne Producer-Aufgabe g\xE4be es die Submit-Aktion ohne freischaltendes Work-Item.`,en:`[governedDocument/productionAssign] Node "${e.id}" (production '${e.production}') wires no producer team (assign.prepareDocument) \u2014 without a producer task there would be the submit action without an enabling work item.`})),e.approval==="none"&&(y.releaseApproval!==void 0&&r.push(Se(e,"assign.releaseApproval",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat approval 'none', verdrahtet aber assign.releaseApproval \u2014 tote Verdrahtung darf nicht als konfiguriert durchgehen (Betriebsart explizit \xE4ndern statt Gruppen zuweisen).`,en:`[governedDocument/deadWiring] Node "${e.id}" has approval 'none' but wires assign.releaseApproval \u2014 dead wiring must not pass as configured (change the mode explicitly instead of assigning groups).`})),c?.approve!==void 0&&r.push(Se(e,"titles.approve",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat approval 'none', deklariert aber titles.approve \u2014 es gibt keine Freigabe-Aufgabe, die diesen Titel tr\xFCge.`,en:`[governedDocument/deadWiring] Node "${e.id}" has approval 'none' but declares titles.approve \u2014 there is no release task that would carry this title.`}))),i.checksReturn)y.responseCheck===void 0&&r.push(Se(e,"assign.responseCheck",{de:`[governedDocument/checkAssign] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') verdrahtet kein Team f\xFCr die Pr\xFCfung des R\xFCcklaufs (assign.responseCheck) \u2014 ohne Team l\xE4ge jeder R\xFCcklauf bei niemandem.`,en:`[governedDocument/checkAssign] Node "${e.id}" (responseStrategy '${e.responseStrategy}') wires no team for checking the returned copy (assign.responseCheck) \u2014 without a team every returned copy would lie with nobody.`})),e.production!=="resolver"&&i.issuesBy==="provider"?r.push(Se(e,"responseStrategy",{de:`[governedDocument/eSignatureNeedsResolver] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben (eSignature), erzeugt das Dokument aber mit production '${e.production}' \u2014 der Anbieter bekommt eine eingefrorene Vertragsrevision mit Unterschriftsankern und deklarierten Unterzeichnern, und die entsteht nur mit production 'resolver'.`,en:`[governedDocument/eSignatureNeedsResolver] Node "${e.id}" is signed electronically (eSignature) but produces the document with production '${e.production}' \u2014 the provider gets a frozen contract revision with signature anchors and declared signatories, and that only exists with production 'resolver'.`})):e.production!=="resolver"&&r.push(Se(e,"responseStrategy",{de:`[governedDocument/checkNeedsContract] Knoten "${e.id}" pr\xFCft den R\xFCcklauf (signedUploadChecked), erzeugt das Dokument aber mit production '${e.production}' \u2014 die Pr\xFCfung hakt die unterzeichnenden Personen einer eingefrorenen Vertragsrevision ab, und die entsteht nur mit production 'resolver'.`,en:`[governedDocument/checkNeedsContract] Node "${e.id}" checks the returned copy (signedUploadChecked) but produces the document with production '${e.production}' \u2014 the check ticks off the signatories of a frozen contract revision, and that only exists with production 'resolver'.`}));else{e.production==="resolver"&&r.push(Se(e,"responseStrategy",{de:`[governedDocument/contractNeedsCheckedReturn] Knoten "${e.id}" erzeugt einen Vertrag (production 'resolver'), beantwortet ihn aber mit '${e.responseStrategy}' \u2014 ein Vertrag gilt erst als unterschrieben, wenn die Schule den R\xFCcklauf gepr\xFCft hat oder ein Anbieter die Unterschrift belegt: responseStrategy muss 'signedUploadChecked' oder 'eSignature' sein (mit assign.responseCheck und titles.check).`,en:`[governedDocument/contractNeedsCheckedReturn] Node "${e.id}" produces a contract (production 'resolver') but answers it with '${e.responseStrategy}' \u2014 a contract only counts as signed once the school has checked the returned copy or a provider proves the signature: responseStrategy must be 'signedUploadChecked' or 'eSignature' (with assign.responseCheck and titles.check).`}));for(let[T,E]of[["assign.responseCheck",y.responseCheck!==void 0],["titles.check",c?.check!==void 0]])E&&r.push(Se(e,T,{de:`[governedDocument/deadWiring] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') deklariert ${T} \u2014 eine Pr\xFCfung des R\xFCcklaufs gibt es nur mit responseStrategy 'signedUploadChecked' oder 'eSignature'.`,en:`[governedDocument/deadWiring] Node "${e.id}" (responseStrategy '${e.responseStrategy}') declares ${T} \u2014 a check of the returned copy only exists with responseStrategy 'signedUploadChecked' or 'eSignature'.`}))}if(i.issuesBy==="provider"?y.signingRecovery===void 0&&r.push(Se(e,"assign.signingRecovery",{de:`[governedDocument/recoveryAssign] Knoten "${e.id}" l\xE4sst elektronisch unterschreiben, verdrahtet aber kein Team f\xFCr die Kl\xE4rung einer Unterschrift, die nicht zustande kommt (assign.signingRecovery) \u2014 \u201EErneut senden" und \u201EAuf Papier umstellen" l\xE4gen bei niemandem.`,en:`[governedDocument/recoveryAssign] Node "${e.id}" is signed electronically but wires no team for resolving a signature that does not come about (assign.signingRecovery) \u2014 "Send again" and "Switch to paper" would lie with nobody.`})):y.signingRecovery!==void 0&&r.push(Se(e,"assign.signingRecovery",{de:`[governedDocument/deadWiring] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') deklariert assign.signingRecovery \u2014 eine Kl\xE4rung der elektronischen Unterschrift gibt es nur mit responseStrategy 'eSignature'.`,en:`[governedDocument/deadWiring] Node "${e.id}" (responseStrategy '${e.responseStrategy}') declares assign.signingRecovery \u2014 resolving an electronic signature only exists with responseStrategy 'eSignature'.`})),i.issuesBy==="provider"&&r.push(...ZZ(e,t),...XZ(e,t?.signingProvider)),e.confirmBeforeIssue!==void 0&&typeof e.confirmBeforeIssue!="boolean"?r.push(Se(e,"confirmBeforeIssue",{de:`[governedDocument/confirmBeforeIssue] Knoten "${e.id}" setzt confirmBeforeIssue auf ${JSON.stringify(e.confirmBeforeIssue)} \u2014 erlaubt ist nur true oder false.`,en:`[governedDocument/confirmBeforeIssue] Node "${e.id}" sets confirmBeforeIssue to ${JSON.stringify(e.confirmBeforeIssue)} \u2014 only true or false is allowed.`})):e.confirmBeforeIssue===!0&&e.approval==="release"&&r.push(Se(e,"confirmBeforeIssue",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat approval 'release', deklariert aber confirmBeforeIssue \u2014 \u201EFreigabe anfordern" schickt noch nichts an die Familie, und die Freigabe selbst ist die bewusste Pr\xFCfung vor dem Versand. Die R\xFCckfrage gibt es nur mit approval 'none'.`,en:`[governedDocument/deadWiring] Node "${e.id}" has approval 'release' but declares confirmBeforeIssue \u2014 "Request release" sends nothing to the family yet, and the release itself is the deliberate check before sending. The confirmation prompt only exists with approval 'none'.`})),e.confirmContractTerms!==void 0&&typeof e.confirmContractTerms!="boolean"&&r.push(Se(e,"confirmContractTerms",{de:`[governedDocument/confirmContractTerms] Knoten "${e.id}" setzt confirmContractTerms auf ${JSON.stringify(e.confirmContractTerms)} \u2014 erlaubt ist nur true oder false.`,en:`[governedDocument/confirmContractTerms] Node "${e.id}" sets confirmContractTerms to ${JSON.stringify(e.confirmContractTerms)} \u2014 only true or false is allowed.`})),yc(e))e.confirmContractTerms===!1&&e.contractTermsQuestionText!==void 0&&r.push(Se(e,"contractTermsQuestionText",{de:`[governedDocument/deadWiring] Knoten "${e.id}" schaltet die Best\xE4tigung der Vertragsbedingungen ab (confirmContractTerms: false), formuliert aber die Frage um \u2014 ohne Best\xE4tigung wird sie nie gestellt.`,en:`[governedDocument/deadWiring] Node "${e.id}" switches off the confirmation of the contract terms (confirmContractTerms: false) but rewords the question \u2014 without the confirmation it is never asked.`}));else for(let[T,E]of[["confirmContractTerms",e.confirmContractTerms!==void 0],["contractTermsQuestionText",e.contractTermsQuestionText!==void 0]])E&&r.push(Se(e,T,{de:`[governedDocument/deadWiring] Knoten "${e.id}" (responseStrategy '${e.responseStrategy}') deklariert ${T} \u2014 die Best\xE4tigung der Vertragsbedingungen geh\xF6rt zum Hochladen der unterschriebenen Fassung, das es nur mit responseStrategy 'signedUpload' oder 'signedUploadChecked' gibt.`,en:`[governedDocument/deadWiring] Node "${e.id}" (responseStrategy '${e.responseStrategy}') declares ${T} \u2014 the confirmation of the contract terms belongs to uploading the signed copy, which only exists with responseStrategy 'signedUpload' or 'signedUploadChecked'.`}));if(e.production==="none")for(let[T,E]of[["confirmBeforeIssue",e.confirmBeforeIssue===!0],["assign.prepareDocument",y.prepareDocument!==void 0],["titles.prepare",c?.prepare!==void 0],["titles.revise",c?.revise!==void 0]])E&&r.push(Se(e,T,{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production 'none', deklariert aber ${T} \u2014 ohne Produktionsphase gibt es keinen Tr\xE4ger daf\xFCr.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production 'none' but declares ${T} \u2014 without a production phase there is nothing to carry it.`}));for(let T of e.tasks??[])iS.has(T.key)&&r.push(Se(e,`tasks.${T.key}`,{de:`[governedDocument/keyShadowsIntrinsic] Task-Key "${T.key}" auf Knoten "${e.id}" kollidiert mit einem intrinsischen Template (${[...iS].join(", ")}) \u2014 anderen Key w\xE4hlen.`,en:`[governedDocument/keyShadowsIntrinsic] Task key "${T.key}" on node "${e.id}" collides with an intrinsic template (${[...iS].join(", ")}) \u2014 choose another key.`}));if(e.production==="resolver"?r.push(...zZ(e,t)):e.inputs?.[Bt]!==void 0&&r.push(Se(e,`inputs.${Bt}`,{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', nennt aber einen Tr\xE4ger \u2014 nur ein erzeugter Vertrag hat eine Vertragspartei der Schule.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but names a legal entity \u2014 only a generated contract has a contracting party on the school's side.`})),r.push(...VZ(e)),e.production==="resolver"){let T=mi(e);if(T!==null){let E=JO(T);for(let $ of Fh(e)){if(!Xi($.type)){r.push(Se(e,`generatorStamp.inputSchema.${$.key}`,{de:`[governedDocument/unknownFieldType] Generator "${E}" typisiert das Feld "${$.key}" als "${String($.type)}" \u2014 das geh\xF6rt nicht zum Wert-Vokabular der Plattform (${sa.join(", ")}). Die gepinnte Revision stammt aus einer \xE4lteren Fassung und muss neu versiegelt werden.`,en:`[governedDocument/unknownFieldType] Generator "${E}" types the field "${$.key}" as "${String($.type)}" \u2014 that is not part of the platform's value vocabulary (${sa.join(", ")}). The pinned revision comes from an older version and must be sealed again.`}));continue}if($.type==="personList"){r.push(Se(e,`generatorStamp.inputSchema.${$.key}`,{de:`[governedDocument/partyListUnsupported] Generator "${E}" deklariert das Feld "${$.key}" als personList \u2014 daf\xFCr gibt es keine Platzhalter-Heimat im Dokument und keine Eingabe. Eine Liste von Personen geh\xF6rt als Rolle mit Kapazit\xE4t deklariert oder als berechneter Textwert.`,en:`[governedDocument/partyListUnsupported] Generator "${E}" declares the field "${$.key}" as personList \u2014 there is no placeholder home for it in the document and no input. A list of people belongs declared as a role with capacity or as a computed text value.`}));continue}$.type==="party"&&($.key.endsWith("PartyId")||r.push(Se(e,`generatorStamp.inputSchema.${$.key}`,{de:`[governedDocument/partyFieldKey] Party-Feld "${$.key}" endet nicht auf "PartyId" \u2014 aus diesem Suffix wird der Platzhalter-Pr\xE4fix im Dokument abgeleitet (emergencyContactPartyId \u2192 emergency_contact).`,en:`[governedDocument/partyFieldKey] Party field "${$.key}" does not end in "PartyId" \u2014 the placeholder prefix in the document is derived from this suffix (emergencyContactPartyId \u2192 emergency_contact).`})))}r.push(...wq(e,{de:`"${E}"`,en:`"${E}"`}))}}else e.generatorStamp!==void 0&&r.push(Se(e,"generatorStamp",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', tr\xE4gt aber den Stempel eines Generators \u2014 ohne maschinelle Produktion l\xE4uft keiner.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but carries a generator stamp \u2014 without machine production none runs.`}));e.production==="template"?r.push(...QZ(e)):e.templateStamp!==void 0&&r.push(Se(e,"templateStamp",{de:`[governedDocument/deadWiring] Knoten "${e.id}" hat production '${e.production}', tr\xE4gt aber die Parameter einer Vorlage \u2014 ohne Vorlagen-Produktion wird sie nie gef\xFCllt.`,en:`[governedDocument/deadWiring] Node "${e.id}" has production '${e.production}' but carries a template's parameters \u2014 without template production it is never filled.`}));let k=e.inputs?.[Ca];k!==void 0&&k.kind!=="unset"&&!(k.kind==="literal"&&typeof k.value=="boolean")&&r.push(Se(e,`inputs.${Ca}`,{de:`[governedDocument/coverLetterInput] Knoten "${e.id}": Die Best\xE4tigung des Anschreibens ist ein fester Wert ja oder nein.`,en:`[governedDocument/coverLetterInput] Node "${e.id}": the cover letter's confirmation is a fixed yes or no.`})),os(e)&&(t!==void 0&&e.generatorStamp?.coverLetter!==!0&&r.push(Se(e,`inputs.${Ca}`,{de:`[governedDocument/coverLetterNotDeclared] Knoten "${e.id}" l\xE4sst ein Anschreiben best\xE4tigen, sein Generator erzeugt aber keines.`,en:`[governedDocument/coverLetterNotDeclared] Node "${e.id}" asks to confirm a cover letter, but its generator produces none.`})),e.approval!=="release"&&r.push(Se(e,"approval",{de:`[governedDocument/coverLetterNeedsRelease] Knoten "${e.id}": Ein Anschreiben mit Best\xE4tigung braucht die Freigabe, denn Vertrag und Anschreiben werden zusammen freigegeben.`,en:`[governedDocument/coverLetterNeedsRelease] Node "${e.id}": a cover letter with confirmation needs the release, because contract and letter are released together.`})),Ei(e).producesResponseArtifact||r.push(Se(e,"responseStrategy",{de:`[governedDocument/coverLetterNeedsSigning] Knoten "${e.id}": Ein Anschreiben steht vor einer Unterschrift; dieser Knoten l\xE4sst nicht unterschreiben.`,en:`[governedDocument/coverLetterNeedsSigning] Node "${e.id}": a cover letter comes before a signature; this node takes none.`})));let w=e.inputs?.[Si],b=w===void 0||w.kind==="unset"?void 0:w.kind==="literal"?w.value:w;return b!==void 0&&!xd(b)&&r.push(Se(e,`inputs.${Si}`,{de:`[governedDocument/dueInDays] Knoten "${e.id}" setzt responseDueInDays auf ${JSON.stringify(b)} \u2014 erlaubt ist eine ganze Zahl von ${rs} bis ${is} Tagen.`,en:`[governedDocument/dueInDays] Node "${e.id}" sets responseDueInDays to ${JSON.stringify(b)} \u2014 a whole number from ${rs} to ${is} days is allowed.`})),b===void 0&&Fh(e).some(T=>T.processSource==="responseDueInDays")&&r.push(Se(e,`inputs.${Si}`,{de:`[governedDocument/dueInDays] Knoten "${e.id}" druckt die Antwortfrist (processSource 'responseDueInDays'), setzt aber kein responseDueInDays \u2014 das Dokument nennte eine Frist, die es nicht gibt.`,en:`[governedDocument/dueInDays] Node "${e.id}" prints the response deadline (processSource 'responseDueInDays') but sets no responseDueInDays \u2014 the document would name a deadline that does not exist.`})),r},"validate")};var bq={addPupil:{method:"POST",path:"/api/v1/admissions/AddPrPupilBasic/{schoolid}",kind:"create",body:"PrPupilBasicCreate",required:["forename","surname","genderId"],maxLength:{titleId:4,forename:50,surname:50,middleName:50,preferredForename:50,preferredSurname:50,genderId:4,firstLanguage:4}},addAdmissionDetails:{method:"POST",path:"/api/v1/admissions/AddAdmissionDetails/{schoolid}/{pupilid}",kind:"create",body:"AddPrPupilAdmissionDetails",required:[],maxLength:{boarderStatusId:4,ageAdjust:4,entryYear:4,entryTerm:4,entryYearGroup:4,currentSchoolId:20,enquirySource:4,currentAdmissionStageId:25}},addNationality:{method:"POST",path:"/api/v1/admissions/AddNationlityInfo/{schoolid}/{pupilid}",kind:"create",body:"NationalityInfoCreate",required:["nationalityId"],maxLength:{nationalityId:4,countryOfBirth:4}},addVisa:{method:"POST",path:"/api/v1/admissions/AddVisaInfo/{schoolid}/{pupilid}",kind:"create",body:"CreateVisaInfo",required:[],maxLength:{placeOfBirth:50,passportCountry:4,passportNumber:50,residenceVisaNumber:50,healthCardNumber:50}},addMedical:{method:"POST",path:"/api/v1/admissions/AddMedicalInfo/{schoolid}/{pupilid}",kind:"create",body:"MedicalInfoCreate",required:[],maxLength:{}},addContact:{method:"POST",path:"/api/v1/admissions/AddContactBasicInfo/{schoolid}/{pupilid}",kind:"create",body:"AddContactBasicInfo",required:["titleId","firstName","lastName","genderId"],maxLength:{relationshipId:4,titleId:4,firstName:50,middleName:50,lastName:50,contactName:200,greeting:200,languageId:4,secondLanguageId:4,genderId:4,professionId:4,companyName:50,jobTitle:50}},linkExistingContact:{method:"POST",path:"/api/v1/admissions/LinkExistingContact/{schoolid}/{pupilid}/{contactid}",kind:"create",body:"LinkContact",required:["relationshipId"],maxLength:{relationshipId:4}},addContactAddress:{method:"POST",path:"/api/v1/admissions/AddContactAddressNew/{schoolid}/{contactid}/{addressformatid}",kind:"create",body:"AddAddressVM",required:["countryId"],maxLength:{addressTypeId:4,countryId:4,addressLine1:100,addressLine2:100,addressLine3:100,addressLine4:100,addressLine5:100,addressLine6:100,lookup1:4,lookup2:4,lookup3:4,lookup4:4,lookup5:4}},addContactEmail:{method:"POST",path:"/api/v1/admissions/AddContactEmail/{schoolid}/{contactid}",kind:"create",body:"AddEmailAddress",required:["emailTypeId","email"],maxLength:{emailTypeId:4,email:254}},addContactTelephone:{method:"POST",path:"/api/v1/admissions/AddContactTelephone/{schoolid}/{contactid}",kind:"create",body:"AddTelephoneNumber",required:["typeId","number"],maxLength:{typeId:4}},linkAddressToPupil:{method:"PUT",path:"/api/v1/admissions/LinkAddressToPupil/{schoolId}/{pupilId}/{addressId}",kind:"update",required:[],maxLength:{}},updatePupilAif:{method:"POST",path:"/api/v1/additionalinformation/UpdatePupilAIF/{schoolid}/{pupilid}",kind:"update",body:"AifFieldValueVM",required:[],maxLength:{}},updateContactAif:{method:"POST",path:"/api/v1/additionalinformation/UpdateContactAIF/{schoolid}/{contactid}",kind:"update",body:"AifFieldValueVM",required:[],maxLength:{}},listPupils:{method:"GET",path:"/api/v1/admissions/GetPrPupilBasicInfo/{schoolid}",kind:"read",required:[],maxLength:{}},getPupil:{method:"GET",path:"/api/v1/admissions/GetPrPupilBasicInfoById/{schoolid}/{pupilid}",kind:"read",required:[],maxLength:{}},listContactsOfPupil:{method:"GET",path:"/api/v1/admissions/GetContactBasicInfoByPupilId/{schoolid}/{pupilid}",kind:"read",required:[],maxLength:{}},getContact:{method:"GET",path:"/api/v1/admissions/GetContactByContactId/{schoolid}/{contactid}",kind:"read",required:[],maxLength:{}},readPupilAifFields:{method:"GET",path:"/api/v1/additionalinformation/ReadPupilAIFFields/{schoolid}",kind:"read",required:[],maxLength:{}},readContactAifFields:{method:"GET",path:"/api/v1/additionalinformation/ReadContactAIFFields/{schoolid}",kind:"read",required:[],maxLength:{}}};function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ht,"isRecord");var sS=["field","join","literal","address","payment","contract"],e9=new Set(["text","date","datetime","bool","aifBool","money","moneyText"]),n9=new Set(["street","streetAndNumber","hausnr","plz","ort","land","full"]);function fr(e){return typeof e=="string"&&e.trim().length>0}s(fr,"nonEmptyString");function Mh(e,n,t,r,i="value"){if(!Ht(e)||!Ht(e.from)){r.push({path:n,code:"mappingShape",message:{de:`${n}: eine Zuordnung braucht \`from\`.`,en:`${n}: a mapping needs \`from\`.`}});return}let o=e.from,a=sS.filter(c=>c in o);if(a.length!==1){r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from\` nennt genau eine Quelle (${sS.join(" | ")}).`,en:`${n}: \`from\` names exactly one source (${sS.join(" | ")}).`}});return}let[l]=a;l==="field"&&!fr(o.field)&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.field\` ist leer.`,en:`${n}: \`from.field\` is empty.`}}),l==="join"&&!(Array.isArray(o.join)&&o.join.length>=2&&o.join.every(fr))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.join\` nennt mindestens zwei Formularfelder.`,en:`${n}: \`from.join\` names at least two form fields.`}}),e.whenEmpty!==void 0&&(i==="condition"?r.push({path:n,code:"mappingShape",message:{de:`${n}: \`whenEmpty\` gilt nicht f\xFCr eine Bedingung (\`unless\`, \`linkAddressToPupilIf\`).`,en:`${n}: \`whenEmpty\` does not apply to a condition (\`unless\`, \`linkAddressToPupilIf\`).`}}):l!=="field"&&l!=="join"?r.push({path:n,code:"mappingShape",message:{de:`${n}: \`whenEmpty\` gilt nur f\xFCr eine Formularantwort (\`field\`, \`join\`).`,en:`${n}: \`whenEmpty\` applies only to a form answer (\`field\`, \`join\`).`}}):typeof e.whenEmpty=="boolean"||Number.isFinite(e.whenEmpty)||fr(e.whenEmpty)||r.push({path:n,code:"mappingShape",message:{de:`${n}: \`whenEmpty\` ist ein Engage-Wert (Text, Zahl oder ja/nein).`,en:`${n}: \`whenEmpty\` is an Engage value (text, number or yes/no).`}})),l==="address"&&!(we(o.address)&&o.address.scope==="env"&&tr(o.address.key))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.address\` ist eine Umgebungsvariable (\`{ scope: 'env', key: 'stage.key' }\`).`,en:`${n}: \`from.address\` is an environment value (\`{ scope: 'env', key: 'stage.key' }\`).`}}),l==="payment"&&o.payment!=="amount"&&o.payment!=="settledAt"&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.payment\` ist amount oder settledAt.`,en:`${n}: \`from.payment\` is amount or settledAt.`}}),l==="contract"&&!["startDate","signedAt","createdAt"].includes(String(o.contract))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.contract\` ist startDate, signedAt oder createdAt.`,en:`${n}: \`from.contract\` is startDate, signedAt or createdAt.`}}),l==="literal"&&!["string","number","boolean"].includes(typeof o.literal)&&r.push({path:n,code:"mappingShape",message:{de:`${n}: \`from.literal\` ist Text, Zahl oder ja/nein.`,en:`${n}: \`from.literal\` is text, a number or yes/no.`}}),e.format!==void 0&&!e9.has(String(e.format))&&r.push({path:n,code:"mappingShape",message:{de:`${n}: unbekanntes Format \u201E${String(e.format)}".`,en:`${n}: unknown format "${String(e.format)}".`}}),e.lookup!==void 0&&!(fr(e.lookup)&&Ht(t[e.lookup]))&&r.push({path:n,code:"unknownLookup",message:{de:`${n}: die Lookup-Tabelle \u201E${String(e.lookup)}" fehlt in \`lookups\`.`,en:`${n}: the lookup table "${String(e.lookup)}" is missing from \`lookups\`.`}});let d=e.pick;d!==void 0&&(d==="firstWord"||d==="restWords"||d==="year"||Ht(d)&&Number.isInteger(d.index)&&Number(d.index)>=0||Ht(d)&&n9.has(String(d.address))||r.push({path:n,code:"mappingShape",message:{de:`${n}: unbekannte Auswahl \`pick\`.`,en:`${n}: unknown selection \`pick\`.`}}))}s(Mh,"checkMapping");function mo(e,n,t,r,i){if(!Ht(e)){i.push({path:n,code:"bodyShape",message:{de:`${n}: erwartet ein Objekt Feld \u2192 Zuordnung.`,en:`${n}: expects an object field \u2192 mapping.`}});return}let o=bq[t];for(let a of o.required)a in e||i.push({path:`${n}.${a}`,code:"missingRequired",message:{de:`${n}: Engage verlangt \u201E${a}" (${o.body}) \u2014 es fehlt eine Zuordnung.`,en:`${n}: Engage requires "${a}" (${o.body}) \u2014 a mapping is missing.`}});for(let[a,l]of Object.entries(e))Mh(l,`${n}.${a}`,r,i)}s(mo,"checkBody");function vq(e,n,t,r){if(e===void 0)return;if(!Array.isArray(e)){r.push({path:n,code:"bodyShape",message:{de:`${n}: erwartet eine Liste.`,en:`${n}: expects a list.`}});return}let i=new Set;e.forEach((o,a)=>{let l=`${n}[${a}]`;if(!Ht(o)||!fr(o.fieldId)){r.push({path:l,code:"aifShape",message:{de:`${l}: \`fieldId\` fehlt.`,en:`${l}: \`fieldId\` is missing.`}});return}i.has(o.fieldId)&&r.push({path:l,code:"aifDuplicate",message:{de:`${l}: \u201E${o.fieldId}" doppelt.`,en:`${l}: "${o.fieldId}" appears twice.`}}),i.add(o.fieldId),Mh(o.value,`${l}.value`,t,r),o.unless!==void 0&&Mh(o.unless,`${l}.unless`,t,r,"condition")})}s(vq,"checkAif");function aS(e){let n=[];if(!Ht(e))return[{path:"engage",code:"missing",message:{de:"Die Engage-Zuordnung `engage` fehlt.",en:"The Engage mapping `engage` is missing."}}];let t=Ht(e.lookups)?e.lookups:{};Ht(e.lookups)||n.push({path:"engage.lookups",code:"bodyShape",message:{de:"`engage.lookups` fehlt (Tabellen Name \u2192 Plexus-Wert \u2192 Engage-Id).",en:"`engage.lookups` is missing (tables name \u2192 Plexus value \u2192 Engage id)."}});for(let[r,i]of Object.entries(t))(!Ht(i)||!Object.values(i).every(fr))&&n.push({path:`engage.lookups.${r}`,code:"lookupShape",message:{de:`Lookup \u201E${r}": jede Engage-Id ist ein nicht leerer Text.`,en:`Lookup "${r}": every Engage id is a non-empty text.`}});if(fr(e.addressFormatId)||n.push({path:"engage.addressFormatId",code:"missing",message:{de:"`engage.addressFormatId` fehlt (GetAddressMappingInfo).",en:"`engage.addressFormatId` is missing (GetAddressMappingInfo)."}}),mo(e.pupil,"engage.pupil","addPupil",t,n),mo(e.admission,"engage.admission","addAdmissionDetails",t,n),e.nationality!==void 0&&mo(e.nationality,"engage.nationality","addNationality",t,n),e.visa!==void 0&&mo(e.visa,"engage.visa","addVisa",t,n),e.medical!==void 0&&mo(e.medical,"engage.medical","addMedical",t,n),vq(e.pupilAif,"engage.pupilAif",t,n),!Array.isArray(e.contacts))n.push({path:"engage.contacts",code:"bodyShape",message:{de:"`engage.contacts` fehlt (Liste der Kontakte).",en:"`engage.contacts` is missing (list of contacts)."}});else{let r=new Set;e.contacts.forEach((i,o)=>{let a=`engage.contacts[${o}]`;if(!Ht(i)||!fr(i.key)||!fr(i.presentIf)){n.push({path:a,code:"contactShape",message:{de:`${a}: \`key\` und \`presentIf\` fehlen.`,en:`${a}: \`key\` and \`presentIf\` are missing.`}});return}r.has(i.key)&&n.push({path:a,code:"contactDuplicate",message:{de:`${a}: Kontakt \u201E${i.key}" doppelt.`,en:`${a}: contact "${i.key}" appears twice.`}}),r.add(i.key),mo(i.basic,`${a}.basic`,"addContact",t,n),i.address!==void 0&&mo(i.address,`${a}.address`,"addContactAddress",t,n);for(let[l,d]of[["emails","addContactEmail"],["telephones","addContactTelephone"]]){let c=i[l];if(c!==void 0){if(!Array.isArray(c)){n.push({path:`${a}.${l}`,code:"bodyShape",message:{de:`${a}.${l}: erwartet eine Liste.`,en:`${a}.${l}: expects a list.`}});continue}c.forEach((u,p)=>mo(u,`${a}.${l}[${p}]`,d,t,n))}}vq(i.aif,`${a}.aif`,t,n),i.linkAddressToPupilIf!==void 0&&Mh(i.linkAddressToPupilIf,`${a}.linkAddressToPupilIf`,t,n,"condition")})}if(e.siblingsAttending!==void 0){let r=e.siblingsAttending;(!Ht(r)||!fr(r.repeated)||!fr(r.field)||!fr(r.equals))&&n.push({path:"engage.siblingsAttending",code:"bodyShape",message:{de:"`engage.siblingsAttending` braucht repeated, field und equals.",en:"`engage.siblingsAttending` needs repeated, field and equals."}})}return n}s(aS,"engagePushConfigIssues");function*lS(e){let n=[e.pupil,e.admission,e.nationality,e.visa,e.medical];for(let t of n)for(let r of Object.values(t??{}))yield{mapping:r};for(let t of e.pupilAif??[])yield{mapping:t.value},t.unless!==void 0&&(yield{mapping:t.unless});for(let t of e.contacts){let r=[t.basic,t.address,...t.emails??[],...t.telephones??[]];for(let i of r)for(let o of Object.values(i??{}))yield{mapping:o,contactKey:t.key};for(let i of t.aif??[])yield{mapping:i.value,contactKey:t.key},i.unless!==void 0&&(yield{mapping:i.unless,contactKey:t.key});t.linkAddressToPupilIf!==void 0&&(yield{mapping:t.linkAddressToPupilIf,contactKey:t.key})}}s(lS,"mappingsOf");function xq(e){let n=new Set(e.contacts.map(t=>t.presentIf));for(let{mapping:t,contactKey:r}of lS(e))for(let i of t9(t.from))n.add(r9(i,r));return[...n]}s(xq,"configFieldKeys");function t9(e){return"field"in e?[e.field]:"join"in e?e.join:[]}s(t9,"formFieldsOf");function r9(e,n){return e.startsWith(".")?(n===void 0&&F(`[engagePush] relative field "${e}" outside a contact`),`${n}${e}`):e}s(r9,"resolveFieldKey");function Sq(e,n){for(let{mapping:t}of lS(e))if(n in t.from)return!0;return!1}s(Sq,"configReadsSource");function Aq(e){let n=new Set;for(let{mapping:t}of lS(e))"address"in t.from&&n.add(t.from.address.key);return[...n]}s(Aq,"configEnvLeaves");var Eq="done",Tq=["sandbox","production"];var qh="engagePush",yMe=660*1e3;function ho(e,n,t,r="error"){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:r}}s(ho,"issue");function dS(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(dS,"literal");function Rq(e){return aS(e.engage).length===0?e.engage:null}s(Rq,"validConfig");function i9(e,n){let t=new Map(e.nodes.map(a=>[a.id,a])),r=e.nodes.filter(a=>a.type==="eventTrigger"),i=new Set,o=r.map(a=>a.id);for(;o.length>0;){let a=o.pop();if(a===n||i.has(a))continue;i.add(a);let l=t.get(a);if(l!==void 0){if(l.type==="end"){let d=l.inputs?.applicationOutcome;if(d?.kind==="literal"&&d.value==="approved")return!0;continue}for(let d of Object.values(l.next??{})){let c=d?.to;typeof c=="string"&&o.push(c)}}}return!1}s(i9,"bypassingPath");var $q={role:"system-action",effect:"side-effect",outcomes:[{id:Eq,label:{de:"Angesto\xDFen",en:"Started"}}],envReads:s(e=>{let n=Rq(e);return n===null?[]:Aq(n)},"envReads"),inputs:s(()=>[{id:"target",label:{de:"Ziel-Engage",en:"Target Engage"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"sandbox",label:{de:"Sandbox",en:"Sandbox"}},{value:"production",label:{de:"Produktion",en:"Production"}}]},{id:"contractFields",label:{de:"Vertragsfelder F01\u2013F25",en:"Contract fields F01\u2013F25"},type:"enum",required:!1,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"off",label:{de:"Nicht \xFCbertragen (Bedeutung offen)",en:"Do not transfer (meaning open)"}},{value:"on",label:{de:"\xDCbertragen",en:"Transfer"}}]}],"inputs"),validate:s((e,n,t)=>{let r=e.label?.de??e.id,i=e.label?.en||e.id,o=[],a=dS(e,"target");Tq.includes(a)||o.push(ho(e,"inputs.target",{de:`[engagePush/invalidTarget] \u201E${r}": das Ziel ist sandbox oder production.`,en:`[engagePush/invalidTarget] "${i}": the target is sandbox or production.`}));let l=dS(e,"contractFields");l!==void 0&&l!=="off"&&l!=="on"&&o.push(ho(e,"inputs.contractFields",{de:`[engagePush/contractFields] \u201E${r}": Vertragsfelder sind off oder on.`,en:`[engagePush/contractFields] "${i}": contract fields are off or on.`})),e.assign?.[qh]===void 0&&o.push(ho(e,"assign",{de:`[engagePush/assign] \u201E${r}": wer eine stehen gebliebene \xDCbertragung pr\xFCft, fehlt \u2014 \`assign.${qh}\` nennt das Team.`,en:`[engagePush/assign] "${i}": nobody is set to check a stalled transfer \u2014 \`assign.${qh}\` names the team.`}));for(let k of aS(e.engage))o.push(ho(e,k.path,{de:`[engagePush/config] \u201E${r}": ${k.message.de}`,en:`[engagePush/config] "${i}": ${k.message.en}`}));let d=n.nodes.filter(k=>k.id!==e.id&&k.type==="engagePush"&&dS(k,"target")===a);d.length>0&&o.push(ho(e,"inputs.target",{de:`[engagePush/twice] \u201E${r}": ${d.map(k=>`"${k.id}"`).join(", ")} \xFCbertr\xE4gt schon an dasselbe Ziel.`,en:`[engagePush/twice] "${i}": ${d.map(k=>`"${k.id}"`).join(", ")} already transfers to the same target.`})),i9(n,e.id)&&o.push(ho(e,"next",{de:`[engagePush/bypassed] \u201E${r}": ein Weg erreicht ein \u201Eangenommen"-Ende, ohne durch die Engage-\xDCbertragung zu laufen \u2014 was dort angenommen wird, k\xE4me nie in Engage an.`,en:`[engagePush/bypassed] "${i}": a path reaches an "accepted" end without passing through the Engage transfer \u2014 what is accepted there would never reach Engage.`}));let c=Rq(e),u=e;for(let[k,w,b,T]of[["contract","contract","Vertrag","Contract"],["payment","payment","Zahlung","Payment"]])c===null||!Sq(c,k)||u[w]!==void 0||o.push(ho(e,w,{de:da("address/missing",{where:`\u201E${r}\u201C \u203A ${b}`},"de"),en:da("address/missing",{where:`"${i}" \u203A ${T}`},"en")}));let p=u.form,h=we(p)&&p.scope==="node"?p.owner:void 0,y=h===void 0?void 0:t?.readinessFormFieldsByFormNode?.get(h);if(c!==null&&y!==void 0){let k=new Set(y.keys()),w=xq(c).filter(b=>!k.has(b)&&!/\[\d+\]\./.test(b));if(w.length>0){let b=n.nodes.find(T=>T.id===h);o.push(ho(e,"engage",{de:`[engagePush/unmappedField] \u201E${r}": diese Felder kennt das Formular \u201E${b?.label?.de??h}" nicht \u2014 sie werden nicht \xFCbertragen: ${w.join(", ")}.`,en:`[engagePush/unmappedField] "${i}": the form "${b?.label?.en||h}" does not know these fields \u2014 they are not transferred: ${w.join(", ")}.`},"warning"))}}return o},"validate")};var ys={join:nM,end:rN,roleAssign:rM,eventTrigger:iM,waitlist:bM,completenessCheck:$M,form:uM,setFlag:fM,if:pM,decision:gs,review:OM,collectPayment:FM,governedDocument:kq,countersign:_D,engagePush:$q};N_(ys);function Iq(e,n){let t=e;if(t==null||!Array.isArray(t.nodes))throw new Error(`offer plan: the ${n} carries no workflow graph with nodes`);return e}s(Iq,"graphOf");function Oq(e){let n=new Map;for(let t of e.nodes)for(let r of Zr(e,t))n.set(de(r.address),r.nodeId);return n}s(Oq,"producedOf");function _q(e){let n=new Map;for(let t of e.nodes)n.set(t.id,new Set(Bo(e,t).map(r=>de(r.address))));return n}s(_q,"readsOf");function Pq(e,n){let t=Iq(e,"bundle"),r=Iq(n.graph,"live head"),i=Oq(t),o=Oq(r),a={added:[],removed:[],moved:[]};for(let[u,p]of i){let h=o.get(u);h===void 0?a.added.push({address:u,nodeId:p}):h!==p&&a.moved.push({address:u,from:h,to:p})}for(let[u,p]of o)i.has(u)||a.removed.push({address:u,nodeId:p});let l=_q(t),d=_q(r),c=[];for(let u of new Set([...l.keys(),...d.keys()])){let p=l.get(u)??new Set,h=d.get(u)??new Set,y=[...p].filter(w=>!h.has(w)),k=[...h].filter(w=>!p.has(w));(y.length>0||k.length>0)&&c.push({nodeId:u,added:y,removed:k})}return{headRevision:n.revision,pinnedApplications:n.pinnedApplications,produced:a,reads:c}}s(Pq,"planAddresses");function Nq(e){let n=[...e.produced.moved.map(i=>({icon:"~",target:`address:${i.address}`,status:`Knoten ${i.from} \u2192 ${i.to}`})),...e.produced.added.map(i=>({icon:"+",target:`address:${i.address}`,status:`neu (${i.nodeId})`})),...e.produced.removed.map(i=>({icon:"-",target:`address:${i.address}`,status:`entfernt (${i.nodeId})`})),...e.reads.map(i=>({icon:"~",target:`reads:${i.nodeId}`,status:[i.added.length>0?`+${i.added.join(", ")}`:"",i.removed.length>0?`\u2212${i.removed.join(", ")}`:""].filter(Boolean).join(" ")}))];if(n.length===0)return[];let{real:t,test:r}=e.pinnedApplications;return n.push({icon:"!",target:"pinned",status:`${t+r} Anmeldungen (${t} echt, ${r} Test) auf Fassung ${e.headRevision} bleiben auf ihrer Version \u2014 Umpinnen nur per Migration mit Abbildung`}),n}s(Nq,"addressPlanRows");function Cq(e,n){return n==null?!0:Pe(e)!==Pe(n)}s(Cq,"changed");async function Dq(e,n,t){if(n.index.module!==Ax.name)throw new Error(`offer: unknown module "${n.index.module}"`);return uF(e,n,t,{afterManifestPublish:s(async()=>{if(n.index.links?.unitKey||n.index.program)return Ax.scaffold(e,n.index.slugs.manifest,n.index,{dryRun:t.dryRun??!1})},"afterManifestPublish")})}s(Dq,"applyOffer");async function Fq(e,n,t,r="published"){let i=await e.query(x.setup.offerBundle.exportOfferBundle,{client:n,offerKey:t,generation:r});return{bundle:i.bundle,generation:i.generation,revision:i.revision}}s(Fq,"exportOffer");async function cS(e,n){let{index:t}=n,i=(await e.query(x.workflow.listManifests,{client:t.tenant})).find(y=>y.offerKey===t.slugs.manifest),o="create";i&&(o="same");let a={};for(let[y,k]of Object.entries(n.smartforms??{})){let w=i?await e.query(x.forms.getSmartFormBySlug,{client:t.tenant,offerVersionId:i.offerVersionId,slug:y}):null;a[y]=w?.def?Cq(k,{label:w.def.label,...w.def.definition})?"change":"same":"create"}let l="absent",d=null;if(n.workflow!==void 0){if(l="create",i?.workflowDefinitionId){let y=await e.query(x.workflow.getWorkflowDef,{workflowDefinitionId:i.workflowDefinitionId}),k=y?.publishedVersion??y?.draftVersion;l=Cq(k&&{graph:Qs(n.workflow.graph),progressLayout:n.workflow.progressLayout??k.progressLayout,progressWiring:n.workflow.progressWiring??k.progressWiring},k&&{graph:Qs(k.graph),progressLayout:k.progressLayout,progressWiring:k.progressWiring})?"change":"same"}if(i){let y=await e.query(x.workflow.getOfferHeadPins,{client:t.tenant,offerKey:t.slugs.manifest});y!==null&&(d=Pq(n.workflow.graph,y))}}let c=t.program?.stages,u=c===void 0?[]:i?await Sx(e,t.tenant,t.slugs.manifest,c):rp(null,[],c),p=await Ah(e,t.tenant,i?t.slugs.manifest:null,t),h=i?await e.query(x.workflow.getOfferPublishState,{client:t.tenant,offerKey:t.slugs.manifest}):null;return{manifest:o,smartforms:a,workflow:l,addresses:d,stages:u,capacities:p,publishPending:h?.draftDiffersFromExternal??null,draftRevision:h?.draftRevision??null,externalHeadRevision:h?.externalHeadRevision??null}}s(cS,"diffOffer");function Kh(e){if(e.type==="governedDocument"){let n=e.production;return n==="resolver"?"resolver":n==="template"?"template":n==="upload"||n==="none"?"manual":"unauthored"}return null}s(Kh,"contractProductionModeOf");function Lq(e){return Kh(e)==="resolver"}s(Lq,"isResolverCarrierNode");function jh(e){return(e.workflow?.graph?.nodes??[]).flatMap(t=>{let r=mi(t);return!Lq(t)||r===null?[]:[{node:t,key:r.key,kind:r.kind,...r.revision===void 0?{}:{revision:r.revision}}]})}s(jh,"authoredPins");var Mq={type:"address",dataType:"composite"};var qq={type:"boolean",dataType:"boolean"};var Kq={type:"consent",dataType:"boolean"};var jq={type:"date",dataType:"date"};var Vq={type:"docRef",dataType:"file"};var Bq={type:"email",dataType:"text"};var Uq={type:"string",dataType:"text"};var Gq={type:"tel",dataType:"text"};var Vh={address:Mq.dataType,boolean:qq.dataType,consent:Kq.dataType,date:jq.dataType,docRef:Vq.dataType,email:Bq.dataType,enum:KP.dataType,string:Uq.dataType,tel:Gq.dataType};function uS(e){return{type:e.type,multiple:e.multiple===!0,enumListKey:e.enumListKey,enumOptions:e.enumOptions}}s(uS,"shapeOf");function zq(e){let n=new Map,t=[],r=s(o=>{o.fields.forEach(a=>n.set(a.key,uS(a))),o.groups?.forEach(a=>a.fields.forEach(l=>n.set(l.key,uS(l)))),o.repeated?.forEach(a=>t.push({key:a.key,itemTemplate:a.itemTemplate,effects:a.effects??[]})),o.subsections?.forEach(r)},"visit");e.sections.forEach(r);let i=[{pathPrefix:"",effects:e.effects??[],shapes:n}];for(let o of t){let a=new Map(n);o.itemTemplate.forEach(l=>a.set(`$item.${l.key}`,uS(l))),i.push({pathPrefix:`repeated '${o.key}'.`,effects:o.effects,shapes:a})}return i}s(zq,"fieldMapScopes");function o9(e){let n=new Set,t=s(r=>{r.computed?.forEach(i=>n.add(i.key)),r.subsections?.forEach(t)},"visit");return e.sections.forEach(t),n}s(o9,"computedKeysOf");function Wq(e){let n=[],t=o9(e);for(let r of zq(e))r.effects.forEach((i,o)=>{if(i.kind!=="fieldMap")return;let a=new Map;i.mappings.forEach((l,d)=>{let c=`${r.pathPrefix}effects[${o}].mappings[${d}]`;t.has(l.from)&&n.push({severity:"error",path:`${c}.from`,code:"fieldmap.computed-source",message:`Effect '${i.id}' fieldMap '${l.from}' \u2192 '${l.to}': '${l.from}' is a computed field. Its value is derived, never stored, and would never reach the party.`});let u=a.get(l.to);u!==void 0&&u!==l.from?n.push({severity:"error",path:`${c}.to`,code:"fieldmap.duplicate-target",message:`Effect '${i.id}' maps both '${u}' and '${l.from}' onto custom field '${l.to}'. One party field holds one value \u2014 the write would keep one and drop the other.`}):a.set(l.to,l.from)})});return n}s(Wq,"validateFieldMapSources");function Yq(e){let n=[],t=new Set;for(let o of zq(e))for(let a of o.effects)if(a.kind==="fieldMap")for(let l of a.mappings)t.add(l.from);let r=s((o,a)=>{let l=a.some(d=>t.has(d));o.kind==="cf_value"&&!l?n.push({severity:"error",path:`field '${o.key}'`,code:"persist.cf-unmapped",message:`Field '${o.key}' declares kind 'cf_value' but is not the source of any fieldMap mapping. Either wire a fieldMap ('${o.key}' \u2192 a custom-field key) or set kind: 'control'.`}):o.kind==="control"&&l&&n.push({severity:"error",path:`field '${o.key}'`,code:"persist.control-mapped",message:`Field '${o.key}' declares kind 'control' but is used as a fieldMap source, which would persist it. Set kind: 'cf_value', or remove the fieldMap mapping (a control field may still feed OutcomeDef.output.fields).`})},"check"),i=s(o=>{o.fields.forEach(a=>r(a,[a.key])),o.groups?.forEach(a=>a.fields.forEach(l=>r(l,[l.key]))),o.repeated?.forEach(a=>a.itemTemplate.forEach(l=>r(l,[`$item.${l.key}`,l.key]))),o.subsections?.forEach(i)},"visit");return e.sections.forEach(i),n}s(Yq,"validateFieldPersistence");var s9="$";function a9(e){return typeof e=="string"&&e.startsWith(s9)}s(a9,"isRef");function Bh(e){return e.slice(1)}s(Bh,"stripRef");function*l9(e){switch(e.kind){case"relationship":if(yield e.from,yield e.to,e.meta)for(let n of Object.values(e.meta))yield n;return;case"fieldMap":yield e.target;return;case"shareValue":yield e.from,yield e.to;return;case"person":case"organization":return}}s(l9,"refSlots");function d9(e){let n=new Set;for(let t of l9(e))a9(t)&&n.add(Bh(t));return[...n]}s(d9,"collectRefs");function c9(e){let n=new Set(e.map(o=>o.id)),t=new Map,r=new Map,i=new Map;for(let o of e)i.set(o.id,o),t.set(o.id,[]),r.set(o.id,[]);for(let o of e)for(let a of d9(o))n.has(a)&&(t.get(o.id).push(a),r.get(a).push(o.id));for(let o of e){if(o.kind!=="shareValue")continue;let a=Bh(o.from);for(let l of e)l.id===o.id||!(l.kind==="fieldMap"&&Bh(l.target)===a||l.kind==="shareValue"&&Bh(l.to)===a)||t.get(o.id).includes(l.id)||(t.get(o.id).push(l.id),r.get(l.id).push(o.id))}return{refsOf:t,successors:r,byId:i}}s(c9,"buildAdjacency");function Hq(e){let{refsOf:n}=c9(e),r=fm(e.map(i=>i.id),i=>(n.get(i)??[]).map(o=>({target:o,edge:null})))[0];return r===void 0?{hasCycle:!1}:{hasCycle:!0,cycle:r.cycle}}s(Hq,"detectCycle");function Jq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(Jq,"escapeRegExp");function go(e){return new RegExp(`^${Jq(e)}\\[(\\d+)\\]\\.(.+)$`)}s(go,"repeatedRowKeyPattern");function fS(e,n){let t=go(n),r=0;for(let i of Object.keys(e)){let o=i.match(t);if(!o)continue;let a=Number(o[1]);Number.isInteger(a)&&a+1>r&&(r=a+1)}return r}s(fS,"countRepeatedRows");function Qq(e,n,t){let r=go(n);for(let[i,o]of Object.entries(e)){let a=i.match(r);if(!(!a||Number(a[1])!==t)&&o!=null&&!(typeof o=="string"&&o.trim()==="")&&!(Array.isArray(o)&&o.length===0))return!0}return!1}s(Qq,"repeatedRowHasData");function Zq(e){return e.endsWith(".count")?e.slice(0,-6):e}s(Zq,"readKeyOf");function pS(e){return{sections:e,fields:[]}}s(pS,"hiddenSectionsOnly");function Xq(e,n,t){for(let r of e.fields)n.add(r.key);for(let r of e.groups??[])for(let i of r.fields)n.add(i.key);for(let r of e.computed??[])n.add(r.key);for(let r of e.repeated??[])t.add(r.key);for(let r of e.subsections??[])Xq(r,n,t)}s(Xq,"collectKeys");function eK(e){let n=[],t=s(r=>{if(r.visibleTo!==void 0){let i=new Set,o=new Set;Xq(r,i,o),n.push({sectionId:r.id,label:r.label,visibleTo:r.visibleTo,fieldKeys:i,repeatedKeys:o,rowKeyPatterns:[...o].map(go)});return}for(let i of r.subsections??[])t(i)},"visit");for(let r of e.sections)t(r);return n}s(eK,"restrictedSectionsOf");function nK(e,n){return n.fieldKeys.has(e)||n.repeatedKeys.has(e)?!0:n.rowKeyPatterns.some(t=>t.test(e))}s(nK,"matchesKey");function u9(e,n){return n.find(t=>nK(e,t))??null}s(u9,"hiddenSectionOfKey");function f9(e,n){for(let t=e;;){if(nK(t,n))return!0;let r=t.lastIndexOf(".");if(r===-1)return!1;t=t.slice(0,r)}}s(f9,"fieldOwnsKey");function p9(e,n){return n.find(t=>f9(e,t))??null}s(p9,"restrictedFieldOfKey");function m9(e,n){let t=u9(e,n.sections);if(t!==null)return{kind:"section",section:t};let r=p9(e,n.fields);return r===null?null:{kind:"field",field:r}}s(m9,"hiddenOwnerOfKey");function Uh(e,n){return m9(e,n)!==null}s(Uh,"isKeyHidden");function h9(e,n,t,r,i){let o=[];r&&o.push({severity:"error",path:t,code:"section.visibleTo-nested",message:{de:`Abschnitt '${e}' liegt in einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo) und darf selbst keine tragen.`,en:`Section '${e}' sits inside a section with restricted visibility (visibleTo) and may not carry one itself.`}});let a=s(l=>typeof l!="string"||l.trim()==="","isBlank");if((n.length===0||n.some(a)||new Set(n).size!==n.length)&&o.push({severity:"error",path:t,code:"section.visibleTo-invalid",message:{de:`Abschnitt '${e}': visibleTo braucht mindestens ein Team, ohne leere oder doppelte Eintr\xE4ge.`,en:`Section '${e}': visibleTo needs at least one team, with no blank or repeated entries.`}}),i===void 0)return o;for(let l of n)a(l)||i.has(l)||o.push({severity:"error",path:t,code:"section.visibleTo-unknown",message:{de:`Abschnitt '${e}': '${l}' ist weder ein Team noch eine Rechtegruppe dieser Schule.`,en:`Section '${e}': '${l}' is neither a team nor a permission group of this school.`}});return o}s(h9,"visibleToListIssues");function tK(e,n,t){let r=[],i=s((c,u,p)=>{let h=c.visibleTo;h!==void 0&&r.push(...h9(c.id,h,`${u}.visibleTo`,p,t));let y=p||h!==void 0;if(y){let k=[...c.fields,...(c.groups??[]).flatMap(w=>w.fields),...(c.repeated??[]).flatMap(w=>w.itemTemplate)];for(let w of k)w.kind==="cf_value"&&r.push({severity:"error",path:`${u}.fields`,code:"section.visibleTo-party",message:{de:`Feld '${w.key}' wird in die Personendaten \xFCbernommen und kann deshalb nicht in einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo) liegen.`,en:`Field '${w.key}' is carried into the person record and therefore cannot sit in a section with restricted visibility (visibleTo).`}})}(c.subsections??[]).forEach((k,w)=>i(k,`${u}.subsections[${w}]`,y))},"visitRaw");e.sections.forEach((c,u)=>i(c,`sections[${u}]`,!1));let o=eK(e);if(o.length===0)return r;let a=s((c,u,p)=>{if(c===void 0)return;let h=pS(p);for(let y of Ln(c)){let k=Zq(y);(Uh(y,h)||Uh(k,h))&&r.push({severity:"error",path:u,code:"section.visibleTo-read-outside",message:{de:`${u} liest '${y}' aus einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo) \u2014 wer den Abschnitt nicht sieht, bek\xE4me hier ein anderes Ergebnis.`,en:`${u} reads '${y}' from a section with restricted visibility (visibleTo) \u2014 whoever cannot see the section would get a different result here.`}})}},"checkAst"),l=s((c,u,p)=>{a(c.visibleIf,`${u}.visibleIf`,p),a(c.requiredIf,`${u}.requiredIf`,p),a(c.disabledIf,`${u}.disabledIf`,p),a(c.defaultValue,`${u}.defaultValue`,p),c.sameAs!==void 0&&Uh(c.sameAs.source,pS(p))&&r.push({severity:"error",path:`${u}.sameAs`,code:"section.visibleTo-read-outside",message:{de:`${u} \xFCbernimmt '${c.sameAs.source}' aus einem Abschnitt mit eingeschr\xE4nkter Sichtbarkeit (visibleTo).`,en:`${u} copies '${c.sameAs.source}' from a section with restricted visibility (visibleTo).`}})},"checkField"),d=s((c,u,p)=>{let h=c.visibleTo!==void 0?c.id:p,y=o.filter(k=>k.sectionId!==h);a(c.visibleIf,`${u}.visibleIf`,c.visibleTo!==void 0?o:y),c.fields.forEach((k,w)=>l(k,`${u}.fields[${w}]`,y)),c.groups?.forEach((k,w)=>{a(k.visibleIf,`${u}.groups[${w}].visibleIf`,y),k.fields.forEach((b,T)=>l(b,`${u}.groups[${w}].fields[${T}]`,y))}),c.repeated?.forEach((k,w)=>{a(k.itemVisibleIf,`${u}.repeated[${w}].itemVisibleIf`,y),k.itemTemplate.forEach((b,T)=>l(b,`${u}.repeated[${w}].itemTemplate[${T}]`,y))}),c.computed?.forEach((k,w)=>a(k.expression,`${u}.computed[${w}]`,y)),c.subsections?.forEach((k,w)=>d(k,`${u}.subsections[${w}]`,h))},"visitCompiled");return n.sections.forEach((c,u)=>d(c,`sections[${u}]`,null)),r}s(tK,"sectionVisibilityIssues");var ai="#";var rK=s(e=>{let n=Vb.find(t=>t.systemColumn===e);return n===void 0&&F(`[personName] no system field backs ${e}`),n.key},"keyOfColumn"),Nr={firstName:rK("persons.firstName"),lastName:rK("persons.lastName")};function iK(e,n){let t={firstName:[],lastName:[]},r=`$${e}`;for(let i of n)if(!(i.kind!=="fieldMap"||i.target!==r))for(let{from:o,to:a}of i.mappings??[])a===Nr.firstName?t.firstName.push(o):a===Nr.lastName&&t.lastName.push(o);return t}s(iK,"personNameKeys");function oK(e){return[...e.firstName,...e.lastName]}s(oK,"personNameKeyList");function sK(e){return e.firstName.length>0||e.lastName.length>0}s(sK,"hasPersonName");function Za(e,n=[],t){let r=[];return e.forEach((i,o)=>{let a=[...n,o];r.push({section:i,path:a,parentId:t});for(let l of Za(i.subsections??[],a,i.id))r.push(l)}),r}s(Za,"walkSections");function g9(e,n){for(let t of e.fields)if(t.key===n)return t;for(let t of e.groups??[])for(let r of t.fields)if(r.key===n)return r;for(let t of e.repeated??[])for(let r of t.itemTemplate)if(r.key===n)return r;return null}s(g9,"findFieldInSection");function aK(e,n){for(let t of Za(e.sections)){let r=g9(t.section,n);if(r)return{section:t.section,field:r}}return null}s(aK,"findField");var y9=["Baby","BookOpen","BriefcaseBusiness","Building2","FileText","GraduationCap","HeartHandshake","Scale","UserCheck","UserRound","Users","UsersRound"],w9=["blue","rose","amber","violet","teal","emerald","slate"];function lK(e){return y9.includes(e)}s(lK,"isBucketIconName");function dK(e){return w9.includes(e)}s(dK,"isBucketColorName");var k9="__clear__";function cK(e){return e===""?"empty":e===k9?"reserved":null}s(cK,"selectOptionValueDefect");var mS=gL.docRef.allowedMime;function gK(e,n={}){let t=$a(e).compiled,r=[],i=new Set,o=new Map,a=new Set,l=new Set,d=new Set,c=new Map,u=new Map;function p(I,O){if(i.has(I))return;i.add(I);let j=o.get(I.id);j&&j!==I?r.push({severity:"error",path:`sections[${O.join(".")}]`,code:"duplicate.section-id",message:{de:`Abschnitts-ID '${I.id}' ist mehrfach deklariert.`,en:`Section id '${I.id}' is declared more than once.`}}):o.set(I.id,I);let D=`sections[${O.join(".")}]`;I.fields.forEach((z,le)=>{Xa(a,z.key,`${D}.fields[${le}]`,"duplicate.field-key",r),l.add(z.key),u.set(z.key,z),c.set(z.key,gS(z)),z.externalFlag&&(z.type!=="boolean"&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"flag.not-boolean",message:{de:`Externes Flag '${z.key}' muss den Typ 'boolean' haben (ist '${z.type}').`,en:`External flag '${z.key}' must be type 'boolean' (got '${z.type}').`}}),z.reviewRequired!==void 0&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"review.on-flag",message:{de:`Externes Flag '${z.key}' ist als pr\xFCfpflichtig markiert \u2014 ein Flag setzt der Prozess, die Familie reicht nichts ein, was jemand pr\xFCfen k\xF6nnte.`,en:`External flag '${z.key}' is marked as requiring review \u2014 the process sets a flag, the family hands in nothing anyone could review.`}}),z.notice!==void 0&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"config.notice-on-flag",message:{de:`Externes Flag '${z.key}' tr\xE4gt einen Hinweis (notice) \u2014 ein Flag wird der Familie nie angezeigt, also auch sein Hinweis nicht.`,en:`External flag '${z.key}' carries a notice \u2014 a flag is never shown to the family, so neither is its notice.`}}),z.defaultValue==null&&r.push({severity:"error",path:`${D}.fields[${le}]`,code:"flag.missing-default",message:{de:`Externes Flag '${z.key}' muss einen defaultValue deklarieren (z. B. "false"), damit es standardm\xE4\xDFig verborgen ist.`,en:`External flag '${z.key}' must declare a defaultValue (e.g. "false") so it is hidden by default.`}})),r.push(...fK(z,`${D}.fields[${le}]`)),r.push(...uK(z,`${D}.fields[${le}]`))}),I.groups?.forEach((z,le)=>{z.fields.forEach((ce,De)=>{Xa(a,ce.key,`${D}.groups[${le}].fields[${De}]`,"duplicate.field-key",r),l.add(ce.key),u.set(ce.key,ce),c.set(ce.key,gS(ce)),ce.externalFlag&&r.push({severity:"error",path:`${D}.groups[${le}].fields[${De}]`,code:"flag.invalid-location",message:{de:`Externes Flag '${ce.key}' muss ein direktes Abschnittsfeld sein, kein Gruppenfeld.`,en:`External flag '${ce.key}' must be a direct section field, not a group field.`}}),r.push(...fK(ce,`${D}.groups[${le}].fields[${De}]`)),r.push(...uK(ce,`${D}.groups[${le}].fields[${De}]`))})}),I.repeated?.forEach((z,le)=>{z.itemTemplate.forEach((ce,De)=>{Xa(a,ce.key,`${D}.repeated[${le}].itemTemplate[${De}]`,"duplicate.field-key",r),c.set(ce.key,gS(ce)),ce.externalFlag&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"flag.invalid-location",message:{de:`Externes Flag '${ce.key}' muss ein direktes Abschnittsfeld sein, kein Feld einer Wiederholung.`,en:`External flag '${ce.key}' must be a direct section field, not a repeated item field.`}}),ce.export&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"export.in-repeated",message:{de:`Feld '${ce.key}' deklariert export in einem itemTemplate einer Wiederholung \u2014 ein zusammengesetztes Blatt gilt je Bewerbung, ein Zeilenfeld je Zeile.`,en:`Field '${ce.key}' declares export inside a repeated itemTemplate \u2014 a compound leaf is per-application, a row field is per-row.`}}),ce.sameAs&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"config.sameas-in-repeated",message:{de:`Feld '${ce.key}' deklariert sameAs in einem itemTemplate einer Wiederholung \u2014 nicht unterst\xFCtzt.`,en:`Field '${ce.key}' declares sameAs inside a repeated itemTemplate \u2014 not supported.`}}),ce.reviewRequired!==void 0&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"review.in-repeated",message:{de:`Feld '${ce.key}' ist in einem itemTemplate einer Wiederholung als pr\xFCfpflichtig markiert \u2014 ein Zeilenfeld hat je Zeile einen Wert, kein Feld der Bewerbung, das man einmal abhaken k\xF6nnte.`,en:`Field '${ce.key}' is marked as requiring review inside a repeated itemTemplate \u2014 a row field has one value per row, no field of the application to tick once.`}}),ce.notice!==void 0&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"config.notice-in-repeated",message:{de:`Feld '${ce.key}' tr\xE4gt einen Hinweis (notice) in einem itemTemplate einer Wiederholung \u2014 dort wird er nicht angezeigt. Den Hinweis an den Abschnitt setzen.`,en:`Field '${ce.key}' carries a notice inside a repeated itemTemplate \u2014 it is not shown there. Put the notice on the section.`}}),ce.type==="docRef"&&ce.docRefConstraints?.multiple===!0&&r.push({severity:"error",path:`${D}.repeated[${le}].itemTemplate[${De}]`,code:"config.docref-multiple-in-repeated",message:{de:`Feld '${ce.key}' setzt docRefConstraints.multiple in einem itemTemplate einer Wiederholung \u2014 ein Mehrfach-Upload ist nur als Abschnitts- oder Gruppenfeld m\xF6glich.`,en:`Field '${ce.key}' sets docRefConstraints.multiple inside a repeated itemTemplate \u2014 a multi-file upload is supported only as a section or group field.`}})})}),I.computed?.forEach(z=>{d.add(z.key),Xa(a,z.key,`${D}.computed[${z.key}]`,"duplicate.field-key",r),z.exportType==="consent"&&r.push({severity:"error",path:`${D}.computed[${z.key}]`,code:"config.consent-computed",message:{de:`Berechnetes Feld '${z.key}' ist als Zustimmung (consent) typisiert \u2014 eine Zustimmung gibt die Person selbst, keine Berechnung. exportType 'boolean' verwenden.`,en:`Computed '${z.key}' is typed as a consent \u2014 a consent is given by the person, never computed. Use exportType 'boolean'.`}}),z.export===!0&&z.exportType===void 0&&r.push({severity:"error",path:`${D}.computed[${z.key}]`,code:"export.computed-untyped",message:{de:`Berechnetes Feld '${z.key}' wird ohne exportType exportiert \u2014 string | number | boolean | date angeben.`,en:`Computed '${z.key}' is exported without an exportType \u2014 declare string | number | boolean | date.`}})}),I.subsections?.forEach((z,le)=>p(z,[...O,le]))}s(p,"visitRawSection"),e.sections.forEach((I,O)=>p(I,[O]));let h=new Set;t.effects.forEach((I,O)=>{Xa(h,I.id,`effects[${O}]`,"duplicate.effect-id",r)});let y=new Set;t.outcomes.forEach((I,O)=>{Xa(y,I.id,`outcomes[${O}]`,"duplicate.outcome-id",r)}),t.outcomes.forEach((I,O)=>{I.output.effectRefs?.forEach((j,D)=>{h.has(j.effect)||r.push({severity:"error",path:`outcomes[${O}].output.effectRefs[${D}]`,code:"ref.unknown-effect",message:{de:`Ergebnis '${I.id}' verweist auf den unbekannten Effekt '${j.effect}'.`,en:`Outcome '${I.id}' references unknown effect '${j.effect}'.`}})})}),t.outcomes.forEach((I,O)=>{I.output.fields?.forEach((j,D)=>{aK(t,j.path)||r.push({severity:"error",path:`outcomes[${O}].output.fields[${D}]`,code:"ref.unknown-field",message:{de:`Ergebnis '${I.id}' verweist auf das unbekannte Feld '${j.path}'.`,en:`Outcome '${I.id}' references unknown field '${j.path}'.`}})})});let k=new Set;for(let I of Za(t.sections))for(let O of I.section.repeated??[])k.add(`${O.key}.count`);for(let I of k)(a.has(I)||d.has(I))&&r.push({severity:"error",path:"sections",code:"duplicate.field-key",message:{de:`'${I}' ist zugleich ein deklarierter Schl\xFCssel und die abgeleitete Zeilenzahl einer Wiederholung \u2014 der abgeleitete Wert w\xFCrde stillschweigend gewinnen.`,en:`'${I}' is both a declared key and the derived row count of a repeated group \u2014 the derived value would silently win.`}});let w={known:new Set([...a,...d,...k]),declaredContext:new Set(e.env??[]),stageKeys:n.stageKeys};r.push(...EC(e)),r.push(...tK(e,t,n.visibleToKeys)),r.push(...lD(e));for(let I of Za(t.sections)){let O=I.section,j=`sections[${I.path.join(".")}]`;O.visibleIf&&(Cr(O.visibleIf,`${j}.visibleIf`,w,!1,r),el(O.visibleIf,`${j}.visibleIf`,c,r)),O.fields.forEach((D,z)=>hS(D,`${j}.fields[${z}]`,w,!1,c,r)),O.groups?.forEach((D,z)=>{D.visibleIf&&(Cr(D.visibleIf,`${j}.groups[${z}].visibleIf`,w,!1,r),el(D.visibleIf,`${j}.groups[${z}].visibleIf`,c,r)),D.fields.forEach((le,ce)=>hS(le,`${j}.groups[${z}].fields[${ce}]`,w,!1,c,r))}),O.repeated?.forEach((D,z)=>{D.itemVisibleIf&&(Cr(D.itemVisibleIf,`${j}.repeated[${z}].itemVisibleIf`,w,!0,r),el(D.itemVisibleIf,`${j}.repeated[${z}].itemVisibleIf`,c,r)),D.itemTemplate.forEach((le,ce)=>hS(le,`${j}.repeated[${z}].itemTemplate[${ce}]`,w,!0,c,r)),D.effects?.forEach((le,ce)=>{le.when&&Cr(le.when,`${j}.repeated[${z}].effects[${ce}].when`,w,!0,r)})}),O.computed?.forEach((D,z)=>Cr(D.expression,`${j}.computed[${z}].expression`,w,!1,r))}t.effects.forEach((I,O)=>{I.when&&Cr(I.when,`effects[${O}].when`,w,!1,r)}),t.outcomes.forEach((I,O)=>{Cr(I.when,`outcomes[${O}].when`,w,!1,r)});let b=new Set(t.outcomes.map(I=>I.id));function T(I,O){I.requiredFor&&I.requiredFor.forEach((j,D)=>{b.has(j)||r.push({severity:"error",path:`${O}.requiredFor[${D}]`,code:"ref.unknown-required-for-outcome",message:{de:`Feld "${I.key}": requiredFor verweist auf das unbekannte Ergebnis "${j}"`,en:`field "${I.key}": requiredFor references unknown outcome "${j}"`}})})}s(T,"checkRequiredFor");for(let I of Za(t.sections)){let O=I.section,j=`sections[${I.path.join(".")}]`;O.fields.forEach((D,z)=>T(D,`${j}.fields[${z}]`)),O.groups?.forEach((D,z)=>{D.fields.forEach((le,ce)=>T(le,`${j}.groups[${z}].fields[${ce}]`))}),O.repeated?.forEach((D,z)=>{D.itemTemplate.forEach((le,ce)=>T(le,`${j}.repeated[${z}].itemTemplate[${ce}]`))})}function E(I,O){let j=s((D,z)=>{let le=(D.type==="docRef"?D.docRefConstraints?.mimeType??[]:[]).filter(Ee=>!mS.includes(Ee));le.length>0&&r.push({severity:"error",path:z,code:"config.docref-type-outside-ceiling",message:{de:`Feld '${D.key}' erlaubt ${le.map(Ee=>`'${Ee}'`).join(", ")} \u2014 kein Dokument-Upload akzeptiert diesen Typ (erlaubt: ${mS.join(", ")}).`,en:`Field '${D.key}' allows ${le.map(Ee=>`'${Ee}'`).join(", ")} \u2014 no document upload accepts that type (allowed: ${mS.join(", ")}).`}});let ce=D.type==="docRef"?D.docRefConstraints?.minFiles:void 0;if(ce!==void 0){let Ee=D.docRefConstraints?.multiple===!0,hn=typeof ce=="number"&&Number.isInteger(ce)&&ce>=2;(!Ee||!hn)&&r.push({severity:"error",path:z,code:"config.docref-min-files",message:Ee?{de:`Feld '${D.key}' setzt docRefConstraints.minFiles auf ${JSON.stringify(ce)} \u2014 erlaubt ist eine ganze Zahl ab 2.`,en:`Field '${D.key}' sets docRefConstraints.minFiles to ${JSON.stringify(ce)} \u2014 it must be a whole number of at least 2.`}:{de:`Feld '${D.key}' setzt docRefConstraints.minFiles ohne docRefConstraints.multiple: true \u2014 eine Mindestanzahl gibt es nur bei einem Mehrfach-Upload.`,en:`Field '${D.key}' sets docRefConstraints.minFiles without docRefConstraints.multiple: true \u2014 a minimum count exists only on a multi-file upload.`}})}D.multiple===!0&&D.type!=="enum"&&r.push({severity:"error",path:z,code:"config.multiple-non-enum",message:{de:`Feld '${D.key}' setzt multiple: true, hat aber den Typ '${D.type}' \u2014 nur 'enum' unterst\xFCtzt Mehrfachauswahl.`+(D.type==="docRef"?" F\xFCr mehrere Dateien docRefConstraints.multiple: true verwenden.":""),en:`Field '${D.key}' sets multiple: true but is type '${D.type}' \u2014 only 'enum' supports multi-select.`+(D.type==="docRef"?" For several files use docRefConstraints.multiple: true.":"")}}),D.presentation==="yesNo"&&D.type!=="boolean"&&r.push({severity:"error",path:z,code:"config.yesno-non-boolean",message:{de:`Feld '${D.key}' setzt presentation: 'yesNo', hat aber den Typ '${D.type}' \u2014 nur 'boolean'-Felder lassen sich als Ja | Nein-Antwort darstellen.`,en:`Field '${D.key}' sets presentation: 'yesNo' but is type '${D.type}' \u2014 only 'boolean' fields can be drawn as the Yes | No answer.`}}),D.presentation==="yesNo"&&D.defaultValue!=null&&r.push({severity:"error",path:z,code:"config.yesno-default",message:{de:`Feld '${D.key}' ist eine Ja | Nein-Frage (presentation: 'yesNo') mit einem defaultValue \u2014 die Familie muss die Antwort selbst w\xE4hlen. Den defaultValue entfernen.`,en:`Field '${D.key}' is a Yes | No question (presentation: 'yesNo') with a defaultValue \u2014 the family must choose the answer themselves. Remove the defaultValue.`}}),r.push(...v9(D,z)),typeof D.minSelections=="number"&&typeof D.maxSelections=="number"&&D.minSelections>D.maxSelections&&r.push({severity:"error",path:z,code:"config.min-gt-max-selections",message:{de:`Feld '${D.key}' hat minSelections (${D.minSelections}) > maxSelections (${D.maxSelections}).`,en:`Field '${D.key}' has minSelections (${D.minSelections}) > maxSelections (${D.maxSelections}).`}}),r.push(...x9(D,z));let De=D.enumRef;De!==void 0&&r.push({severity:"error",path:`${z}.enumRef`,code:"config.enum-ref-retired",message:{de:`Feld '${D.key}' nennt den entfernten Options-Katalog (enumRef '${String(De)}'). Die Optionen im Formular angeben (enumOptions + enumOptionLabels) oder eine Liste des Mandanten binden (enumListKey).`,en:`Field '${D.key}' names the removed option catalog (enumRef '${String(De)}'). Author the options in the form (enumOptions + enumOptionLabels) or bind a tenant list (enumListKey).`}}),(D.enumOptions??[]).forEach((Ee,hn)=>{let Qe=cK(Ee);Qe!==null&&r.push({severity:"error",path:`${z}.enumOptions[${hn}]`,code:"config.enum-option-value",message:{de:Qe==="empty"?`Feld '${D.key}' hat einen leeren Enum-Optionswert \u2014 das Steuerelement kann ihn nicht tragen. Der Option einen Wert geben oder sie streichen: Ein Feld, das unbeantwortet bleiben darf, bietet bereits eine eigene Zeile zum Leeren.`:`Feld '${D.key}' hat den Enum-Optionswert '${Ee}', den die Einzelauswahl f\xFCr ihre Zeile zum Leeren reserviert. Die Option umbenennen.`,en:Qe==="empty"?`Field '${D.key}' has an empty enum option value \u2014 the control cannot carry it. Give the option a value, or drop it: a field that may be left unanswered already offers its own clear row.`:`Field '${D.key}' has the enum option value '${Ee}', which the single select reserves for its clear row. Rename the option.`}})}),(D.attachments??[]).forEach((Ee,hn)=>{if("storageId"in Ee){r.push({severity:"error",path:`${z}.attachments[${hn}]`,code:"config.attachment-source",message:{de:`Anhang des Felds '${D.key}' tr\xE4gt eine rohe 'storageId' \u2014 Anh\xE4nge nennen eine Bibliotheksdatei jetzt per 'fileKey' (plexus-cli files put, dann field attach --file-key).`,en:`Field '${D.key}' attachment carries a raw 'storageId' \u2014 attachments name a library file by 'fileKey' now (plexus-cli files put, then field attach --file-key).`}});return}let Qe=Ee.fileKey!==void 0&&Ee.fileKey!=="",Tn=Ee.url!==void 0&&Ee.url!=="";Qe===Tn&&r.push({severity:"error",path:`${z}.attachments[${hn}]`,code:"config.attachment-source",message:{de:`Anhang des Felds '${D.key}' muss genau eines von 'fileKey' oder 'url' setzen (hat ${Qe&&Tn?"beide":"keines"}).`,en:`Field '${D.key}' attachment must set exactly one of 'fileKey' or 'url' (got ${Qe&&Tn?"both":"neither"}).`}}),Ee.renderAs==="inlineLink"&&Ee.label===void 0&&r.push({severity:"error",path:`${z}.attachments[${hn}]`,code:"config.attachment-inline-link-label",message:{de:`inlineLink-Anhang des Felds '${D.key}' braucht ein 'label' \u2014 die verlinkte Wendung im Feldlabel.`,en:`Field '${D.key}' inlineLink attachment needs a 'label' \u2014 the linked phrase shown in the field label.`}})})},"considerField");I.fields.forEach((D,z)=>j(D,`${O}.fields[${z}]`)),I.groups?.forEach((D,z)=>{D.fields.forEach((le,ce)=>j(le,`${O}.groups[${z}].fields[${ce}]`))}),I.repeated?.forEach((D,z)=>{D.itemTemplate.forEach((le,ce)=>{let De=`${O}.repeated[${z}].itemTemplate[${ce}]`;j(le,De),le.type==="consent"&&r.push({severity:"error",path:De,code:"config.consent-in-repeated",message:{de:`Feld '${le.key}' ist eine Zustimmung in einem Wiederholungsblock \u2014 Zustimmungen stehen nur als Feld eines Abschnitts oder einer Gruppe.`,en:`Field '${le.key}' is a consent inside a repeated block \u2014 a consent stands only as a field of a section or a group.`}})})}),I.subsections?.forEach((D,z)=>E(D,`${O}.subsections[${z}]`))}s(E,"visitFieldConfig"),e.sections.forEach((I,O)=>E(I,`sections[${O}]`)),e.effects.forEach((I,O)=>{if(I.kind==="person"){r.push(...hK(I,e.effects,`effects[${O}]`,j=>l.has(j)));return}I.kind==="organization"&&I.nameFrom?.forEach((j,D)=>{l.has(j)||r.push({severity:"error",path:`effects[${O}].nameFrom[${D}]`,code:"ref.unknown-name-field",message:{de:`Effekt '${I.id}': nameFrom verweist auf das unbekannte Feld '${j}'.`,en:`Effect '${I.id}' nameFrom references unknown field '${j}'.`}})})});let $=s((I,O)=>{if(I.kind!=="person"&&I.kind!=="organization")return;let j=I.display;if(!j){r.push({severity:"error",path:`${O}.display`,code:"display.missing",message:{de:`Effekt '${I.id}' deklariert einen Partei-Bucket, aber kein display \u2014 Titel, Icon und Akzentfarbe der Partei w\xE4ren nicht aufl\xF6sbar.`,en:`Effect '${I.id}' declares a party bucket but no display \u2014 the party's title, icon and accent colour could not be resolved.`}});return}lK(j.icon)||r.push({severity:"error",path:`${O}.display.icon`,code:"display.unknown-icon",message:{de:`Effekt '${I.id}': display.icon '${j.icon}' ist kein bekanntes Bucket-Icon.`,en:`Effect '${I.id}' display.icon '${j.icon}' is not a known bucket icon.`}}),dK(j.color)||r.push({severity:"error",path:`${O}.display.color`,code:"display.unknown-color",message:{de:`Effekt '${I.id}': display.color '${j.color}' ist keine bekannte Bucket-Farbe.`,en:`Effect '${I.id}' display.color '${j.color}' is not a known bucket colour.`}})},"checkBucketDisplay");e.effects.forEach((I,O)=>$(I,`effects[${O}]`));let C=new Set,L=s(I=>{I.kind==="person"?C.add(I.bucket):I.kind==="organization"&&C.add(I.id.replace(/^o\./,""))},"declareBucket");e.effects.forEach(L);let _=new Set,v=s(I=>{for(let O of I)O.repeated?.forEach(j=>j.effects?.forEach(D=>L(D))),v(O.subsections??[])},"collectRepeatedBuckets");v(e.sections);let P=s((I,O)=>{C.size!==0&&I.forEach((j,D)=>{j.bucket===void 0||C.has(j.bucket)||r.push({severity:"error",path:`${O}[${D}].bucket`,code:"bucket.undeclared",message:{de:`Feld '${j.key}' geh\xF6rt zum Bucket '${j.bucket}', aber kein Person-/Organisations-Effekt deklariert ihn \u2014 das Feld geh\xF6rt zu keiner Partei.`,en:`Field '${j.key}' belongs to bucket '${j.bucket}', but no person/organization effect declares it \u2014 the field belongs to no party.`}})})},"checkFieldBuckets"),A=s((I,O)=>{if(_.has(I))return;_.add(I);let j=`sections[${O.join(".")}]`;P(I.fields,`${j}.fields`),I.groups?.forEach((D,z)=>P(D.fields,`${j}.groups[${z}].fields`)),I.repeated?.forEach((D,z)=>P(D.itemTemplate,`${j}.repeated[${z}].itemTemplate`)),I.subsections?.forEach((D,z)=>A(D,[...O,z]))},"visitBucketSection");e.sections.forEach((I,O)=>A(I,[O]));let M=e.effects.flatMap((I,O)=>I.kind==="person"&&I.subject===!0?[{e:I,i:O}]:[]);M.length>1&&M.slice(1).forEach(({e:I,i:O})=>{r.push({severity:"error",path:`effects[${O}].subject`,code:"subject.duplicate",message:{de:`Effekt '${I.id}' deklariert subject:true, aber '${M[0].e.id}' tut es bereits. Genau ein Bucket darf das Subjekt der Bewerbung sein.`,en:`Effect '${I.id}' declares subject:true, but '${M[0].e.id}' already does. Exactly one bucket may be the application subject.`}})}),e.effects.forEach((I,O)=>{if(!(I.kind!=="person"||I.nationalityFrom===void 0)){if(I.subject!==!0){r.push({severity:"error",path:`effects[${O}].nationalityFrom`,code:"nationality.not-subject",message:{de:`Effekt '${I.id}' deklariert nationalityFrom, ist aber nicht das Subjekt der Bewerbung \u2014 die Staatsangeh\xF6rigkeit wird nur f\xFCr das Subjekt der Bewerbung gelesen.`,en:`Effect '${I.id}' declares nationalityFrom but is not the application subject \u2014 nationality is read only for the application subject.`}});return}if(I.nationalityFrom.length===0){r.push({severity:"error",path:`effects[${O}].nationalityFrom`,code:"nationality.empty",message:{de:`Effekt '${I.id}' deklariert ein leeres nationalityFrom \u2014 weglassen oder mindestens ein Feld nennen.`,en:`Effect '${I.id}' declares an empty nationalityFrom \u2014 omit it or name at least one field.`}});return}I.nationalityFrom.forEach((j,D)=>{l.has(j)||r.push({severity:"error",path:`effects[${O}].nationalityFrom[${D}]`,code:"nationality.unknown-field",message:{de:`Effekt '${I.id}': nationalityFrom verweist auf das unbekannte Feld '${j}'.`,en:`Effect '${I.id}' nationalityFrom references unknown field '${j}'.`}})})}});let U=e.effects.flatMap((I,O)=>I.kind==="person"&&I.contractParty!==void 0?[{e:I,i:O,decl:I.contractParty}]:[]);if(U.length>0){let I=new Map;U.forEach(({e:j,i:D})=>{let z=I.get(j.bucket);if(z===void 0){I.set(j.bucket,j.id);return}r.push({severity:"error",path:`effects[${D}].contractParty`,code:"contractParty.duplicate-bucket",message:{de:`Effekt '${j.id}' deklariert eine Vertragspartei auf Bucket '${j.bucket}', aber '${z}' tut es bereits. Ein Bucket ist h\xF6chstens eine Vertragspartei.`,en:`Effect '${j.id}' declares a contract party on bucket '${j.bucket}', but '${z}' already does. A bucket is at most one contract party.`}})});let O=U.filter(({decl:j})=>j.role==="beneficiary");O.slice(1).forEach(({e:j,i:D})=>{r.push({severity:"error",path:`effects[${D}].contractParty.role`,code:"contractParty.duplicate-beneficiary",message:{de:`Effekt '${j.id}' deklariert contractParty.role 'beneficiary', aber '${O[0].e.id}' tut es bereits. Genau ein Bucket darf Leistungsempf\xE4nger sein.`,en:`Effect '${j.id}' declares contractParty.role 'beneficiary', but '${O[0].e.id}' already does. Exactly one bucket may be the beneficiary.`}})}),O.forEach(({e:j,i:D})=>{j.subject!==!0&&r.push({severity:"error",path:`effects[${D}].contractParty.role`,code:"contractParty.beneficiary-not-subject",message:{de:`Effekt '${j.id}' ist der Leistungsempf\xE4nger des Vertrags, aber nicht das Subjekt der Bewerbung. Leistungsempf\xE4nger und Subjekt der Bewerbung sind dieselbe Person \u2014 subject:true auf '${j.id}' setzen.`,en:`Effect '${j.id}' is the contract beneficiary but not the application subject. The beneficiary and the application subject are the same person \u2014 set subject:true on '${j.id}'.`}})}),M.forEach(({e:j,i:D})=>{let z=j.contractParty?.role;z!==void 0&&z!=="beneficiary"&&r.push({severity:"error",path:`effects[${D}].contractParty.role`,code:"contractParty.subject-role-mismatch",message:{de:`Effekt '${j.id}' ist das Subjekt der Bewerbung, deklariert aber contractParty.role '${z}'. Das Subjekt der Bewerbung ist der Leistungsempf\xE4nger des Vertrags.`,en:`Effect '${j.id}' is the application subject but declares contractParty.role '${z}'. The application subject is the contract beneficiary.`}})}),U.some(({decl:j})=>j.signs===!0)||r.push({severity:"error",path:"effects",code:"contractParty.no-signer",message:{de:"Das Formular deklariert Vertragsparteien, aber keine unterschreibt (contractParty.signs). Ein Vertrag ohne Unterzeichner kann nicht erzeugt werden.",en:"The form declares contract parties, but none signs (contractParty.signs). A contract without a signatory cannot be generated."}})}e.effects.forEach((I,O)=>{I.kind==="fieldMap"&&I.mappings.forEach((j,D)=>{a.has(j.from)||r.push({severity:"error",path:`effects[${O}].mappings[${D}].from`,code:"ref.unknown-fieldmap-from",message:{de:`Effekt '${I.id}': fieldMap from '${j.from}' verweist auf ein unbekanntes Feld.`,en:`Effect '${I.id}' fieldMap from '${j.from}' references unknown field.`}})})});for(let[I,O]of u){if(!O.sameAs)continue;let j=`fields[${I}].sameAs`,D=u.get(O.sameAs.source);D===void 0||O.sameAs.source===I?r.push({severity:"error",path:`${j}.source`,code:"ref.unknown-sameas-source",message:{de:O.sameAs.source===I?`Feld '${I}': sameAs.source verweist auf sich selbst.`:`Feld '${I}': sameAs.source verweist auf das unbekannte Feld '${O.sameAs.source}' (muss ein Abschnitts- oder Gruppenfeld sein).`,en:O.sameAs.source===I?`Field '${I}' sameAs.source references itself.`:`Field '${I}' sameAs.source references unknown field '${O.sameAs.source}' (must be a top-level or group field).`}}):D.type!==O.type?r.push({severity:"error",path:`${j}.source`,code:"ref.unknown-sameas-source",message:{de:`Feld '${I}' (${O.type}): sameAs.source '${O.sameAs.source}' hat einen anderen Typ (${D.type}) \u2014 die Spiegelung muss formgleich sein.`,en:`Field '${I}' (${O.type}) sameAs.source '${O.sameAs.source}' has a different type (${D.type}) \u2014 the mirror must be shape-identical.`}}):D.sameAs&&r.push({severity:"error",path:`${j}.source`,code:"ref.unknown-sameas-source",message:{de:`Feld '${I}': sameAs.source '${O.sameAs.source}' deklariert selbst sameAs \u2014 Spiegelketten werden nicht unterst\xFCtzt.`,en:`Field '${I}' sameAs.source '${O.sameAs.source}' itself declares sameAs \u2014 mirror chains are not supported.`}});let z=u.get(O.sameAs.toggle);(z===void 0||z.type!=="boolean")&&r.push({severity:"error",path:`${j}.toggle`,code:"ref.unknown-sameas-toggle",message:{de:z===void 0?`Feld '${I}': sameAs.toggle verweist auf das unbekannte Feld '${O.sameAs.toggle}'.`:`Feld '${I}': sameAs.toggle '${O.sameAs.toggle}' muss den Typ 'boolean' haben (ist '${z.type}').`,en:z===void 0?`Field '${I}' sameAs.toggle references unknown field '${O.sameAs.toggle}'.`:`Field '${I}' sameAs.toggle '${O.sameAs.toggle}' must be type 'boolean' (got '${z.type}').`}}),O.required===!0&&r.push({severity:"error",path:`fields[${I}].required`,code:"config.sameas-static-required",message:{de:`Feld '${I}' deklariert sameAs, ist aber statisch Pflicht \u2014 solange es gespiegelt ist, hat es keinen eigenen Wert, die Slice-Validierung beim Commit w\xFCrde immer scheitern. required: false + requiredIf: "${O.sameAs.toggle} != true" verwenden.`,en:`Field '${I}' declares sameAs but is statically required \u2014 while mirrored it holds no own value, so commit-time slice validation would always fail. Use required: false + requiredIf: "${O.sameAs.toggle} != true".`}})}{let I=new Map;e.effects.forEach(O=>I.set(O.id,O.kind)),e.effects.forEach((O,j)=>{if(O.kind!=="shareValue")return;[["from",O.from],["to",O.to]].forEach(([le,ce])=>{let De=I.get(ce.slice(1));De!==void 0&&De!=="person"&&De!=="organization"&&r.push({severity:"error",path:`effects[${j}].${le}`,code:"ref.sharevalue-endpoint",message:{de:`Effekt '${O.id}': shareValue ${le} '${ce}' muss auf einen Person-/Organisations-Effekt verweisen (ist '${De}').`,en:`Effect '${O.id}' shareValue ${le} '${ce}' must reference a person/organization effect (got '${De}').`}})});let D=O.from.slice(1);e.effects.some(le=>le.kind==="fieldMap"&&le.target.slice(1)===D&&le.mappings.some(ce=>ce.to===O.field)||le.kind==="shareValue"&&le.id!==O.id&&le.to.slice(1)===D&&le.field===O.field)||r.push({severity:"error",path:`effects[${j}].field`,code:"config.sharevalue-missing-source-map",message:{de:`Effekt '${O.id}' teilt das Feld '${O.field}' aus '${O.from}', aber kein fieldMap mit Ziel '${O.from}' bildet auf '${O.field}' ab (und kein shareValue verkn\xFCpft es) \u2014 der Quellwert k\xF6nnte beim Commit nie existieren.`,en:`Effect '${O.id}' shares field '${O.field}' from '${O.from}', but no fieldMap targeting '${O.from}' maps to '${O.field}' (and no shareValue links it in) \u2014 the source value could never exist at commit time.`}})})}e.effects.forEach((I,O)=>{I.kind==="person"&&I.bucket.includes(ai)&&r.push({severity:"error",path:`effects[${O}].bucket`,code:"config.bucket-name-contains-hash",message:{de:`Effekt '${I.id}': bucket '${I.bucket}' darf '${ai}' nicht enthalten (f\xFCr den Zeilen-Namensraum reserviert).`,en:`Effect '${I.id}' bucket '${I.bucket}' must not contain '${ai}' (reserved for the per-row namespace).`}}),I.kind==="organization"&&I.orgKind.includes(ai)&&r.push({severity:"error",path:`effects[${O}].orgKind`,code:"config.bucket-name-contains-hash",message:{de:`Effekt '${I.id}': orgKind '${I.orgKind}' darf '${ai}' nicht enthalten (f\xFCr den Zeilen-Namensraum reserviert).`,en:`Effect '${I.id}' orgKind '${I.orgKind}' must not contain '${ai}' (reserved for the per-row namespace).`}})});let oe=new Set;function Q(I,O){I.repeated?.forEach((j,D)=>{let z=j.effects??[];if(z.length>0){let le=`${O}.repeated[${D}]`,ce=new Set(z.map(se=>se.id)),De=new Set(j.itemTemplate.map(se=>se.key)),Ee=(j.uniqueBy?.length??0)>0,hn=s(se=>se.startsWith("$item.")?De.has(se.slice(6)):l.has(se),"resolvesName"),Qe=s(se=>se.startsWith("$item.")?De.has(se.slice(6)):a.has(se),"resolvesFrom"),Tn=s(se=>{let Wn=se.slice(1);return ce.has(Wn)||h.has(Wn)},"resolvesRef");z.forEach((se,Wn)=>{let gn=`${le}.effects[${Wn}]`;if(h.has(se.id)||oe.has(se.id)?r.push({severity:"error",path:gn,code:"duplicate.repeated-effect-id",message:{de:`Der Effekt '${se.id}' der Wiederholung ist mehrfach deklariert.`,en:`Repeated effect id '${se.id}' is declared more than once.`}}):oe.add(se.id),se.kind==="person"||se.kind==="organization"){$(se,gn),se.kind==="person"&&se.subject===!0&&r.push({severity:"error",path:`${gn}.subject`,code:"subject.in-repeated",message:{de:`Effekt '${se.id}' der Wiederholung deklariert subject:true \u2014 eine Zeile gilt je Zeile, das Subjekt der Bewerbung je Bewerbung. Das Subjekt an einem Effekt der obersten Ebene deklarieren.`,en:`Repeated effect '${se.id}' declares subject:true \u2014 a repeated row is per-row, the application subject is per-application. Declare the subject on a top-level effect.`}}),se.kind==="person"&&se.nationalityFrom!==void 0&&r.push({severity:"error",path:`${gn}.nationalityFrom`,code:"nationality.not-subject",message:{de:`Effekt '${se.id}' der Wiederholung deklariert nationalityFrom \u2014 nur das Subjekt der Bewerbung (ein Effekt der obersten Ebene) tr\xE4gt es.`,en:`Repeated effect '${se.id}' declares nationalityFrom \u2014 only the application subject (a top-level effect) carries it.`}}),se.kind==="person"&&se.contractParty!==void 0&&r.push({severity:"error",path:`${gn}.contractParty`,code:"contractParty.in-repeated",message:{de:`Effekt '${se.id}' der Wiederholung deklariert contractParty \u2014 wer unterschreibt, wird einmal je Bewerbung deklariert, nicht je Zeile. An einem Effekt der obersten Ebene deklarieren.`,en:`Repeated effect '${se.id}' declares contractParty \u2014 who signs is declared once per application, not once per row. Declare it on a top-level effect.`}}),Ee||r.push({severity:"error",path:le,code:"config.repeated-effect-requires-uniqueBy",message:{de:`Wiederholung '${j.key}' hat einen Parteien erzeugenden Effekt '${se.id}', aber kein 'uniqueBy' \u2014 Parteien je Zeile brauchen einen stabilen Identit\xE4tsschl\xFCssel.`,en:`Repeated def '${j.key}' has a party-creating effect '${se.id}' but no 'uniqueBy' \u2014 per-row parties need a stable identity key.`}});let Fe=se.kind==="person"?se.bucket:se.orgKind;Fe.includes(ai)&&r.push({severity:"error",path:`${gn}.${se.kind==="person"?"bucket":"orgKind"}`,code:"config.bucket-name-contains-hash",message:{de:`Effekt '${se.id}' der Wiederholung: ${se.kind==="person"?"bucket":"orgKind"} '${Fe}' darf '${ai}' nicht enthalten.`,en:`Repeated effect '${se.id}' ${se.kind==="person"?"bucket":"orgKind"} '${Fe}' must not contain '${ai}'.`}}),se.kind==="person"&&r.push(...hK(se,z,gn,hn)),se.kind==="organization"&&se.nameFrom?.forEach((Ge,Mt)=>{hn(Ge)||r.push({severity:"error",path:`${gn}.nameFrom[${Mt}]`,code:"ref.unknown-name-field",message:{de:`Effekt '${se.id}' der Wiederholung: nameFrom verweist auf das unbekannte Feld '${Ge}'.`,en:`Repeated effect '${se.id}' nameFrom references unknown field '${Ge}'.`}})}),se.identity?.strategy==="keyed"&&se.identity.keyFrom.forEach((Ge,Mt)=>{Qe(Ge)||r.push({severity:"error",path:`${gn}.identity.keyFrom[${Mt}]`,code:"ref.unknown-fieldmap-from",message:{de:`Effekt '${se.id}' der Wiederholung: identity.keyFrom verweist auf das unbekannte Feld '${Ge}'.`,en:`Repeated effect '${se.id}' identity.keyFrom references unknown field '${Ge}'.`}})})}else if(se.kind==="relationship"){if([["from",se.from],["to",se.to]].forEach(([Fe,Ge])=>{Tn(Ge)||r.push({severity:"error",path:`${gn}.${Fe}`,code:"ref.unknown-repeated-effect",message:{de:`Beziehung '${se.id}' der Wiederholung: ${Fe} verweist auf den unbekannten Effekt '${Ge}'.`,en:`Repeated relationship '${se.id}' ${Fe} references unknown effect '${Ge}'.`}})}),se.meta)for(let[Fe,Ge]of Object.entries(se.meta))typeof Ge=="string"&&Ge.startsWith("$")&&!Tn(Ge)&&r.push({severity:"error",path:`${gn}.meta.${Fe}`,code:"ref.unknown-repeated-effect",message:{de:`Beziehung '${se.id}' der Wiederholung: meta.${Fe} verweist auf den unbekannten Effekt '${Ge}'.`,en:`Repeated relationship '${se.id}' meta.${Fe} references unknown effect '${Ge}'.`}})}else se.kind==="fieldMap"?(Tn(se.target)||r.push({severity:"error",path:`${gn}.target`,code:"ref.unknown-repeated-effect",message:{de:`fieldMap '${se.id}' der Wiederholung: Ziel verweist auf den unbekannten Effekt '${se.target}'.`,en:`Repeated fieldMap '${se.id}' target references unknown effect '${se.target}'.`}}),se.mappings.forEach((Fe,Ge)=>{Qe(Fe.from)||r.push({severity:"error",path:`${gn}.mappings[${Ge}].from`,code:"ref.unknown-fieldmap-from",message:{de:`fieldMap '${se.id}' der Wiederholung: from '${Fe.from}' verweist auf ein unbekanntes Feld.`,en:`Repeated fieldMap '${se.id}' from '${Fe.from}' references unknown field.`}})})):se.kind==="shareValue"&&r.push({severity:"error",path:gn,code:"config.sharevalue-in-repeated",message:{de:`Effekt '${se.id}' der Wiederholung: shareValue wird in Effekten von Wiederholungszeilen nicht unterst\xFCtzt.`,en:`Repeated effect '${se.id}': shareValue is not supported inside repeated row effects.`}})})}}),I.subsections?.forEach((j,D)=>Q(j,`${O}.subsections[${D}]`))}s(Q,"visitRepeatedEffects"),e.sections.forEach((I,O)=>Q(I,`sections[${O}]`));let re=Hq(t.effects);return re.hasCycle&&r.push({severity:"error",path:"effects",code:"graph.effect-cycle",message:{de:`Der Effektgraph enth\xE4lt einen Zyklus: ${re.cycle?.join(" \u2192 ")??"?"}`,en:`Effect graph contains a cycle: ${re.cycle?.join(" \u2192 ")??"?"}`}}),r.push(...b9(e)),r}s(gK,"validateForm");function b9(e){let n={...e,effects:e.effects.map(yK),sections:e.sections.map(wK),testScenarios:e.testScenarios?.map(t=>({id:t.id,label:t.label,description:t.description}))};return wm(n,"form").map(t=>({severity:"error",path:t.path,code:"i18n.missing-translation",message:Uk(t)}))}s(b9,"missingTranslationIssues");function yK(e){if(!("subject"in e))return e;let{subject:n,...t}=e;return t}s(yK,"withoutSubjectFlag");function wK(e){return{...e,repeated:e.repeated?.map(n=>({...n,effects:n.effects?.map(yK)})),subsections:e.subsections?.map(wK)}}s(wK,"withoutRowSubjectFlags");function uK(e,n){let t=e.reviewRequired;return t===void 0||t===!0?[]:[{severity:"error",path:n,code:"review.shape",message:{de:`Feld '${e.key}' setzt reviewRequired auf ${JSON.stringify(t)} \u2014 erlaubt ist nur true; ein nicht pr\xFCfpflichtiges Feld l\xE4sst die Angabe weg.`,en:`Field '${e.key}' sets reviewRequired to ${JSON.stringify(t)} \u2014 only true is allowed; a field that needs no review omits it.`}}]}s(uK,"reviewRequiredShapeIssues");function fK(e,n){if(!e.export)return[];let t=[];return e.type==="docRef"&&t.push({severity:"error",path:n,code:"export.invalid-type",message:{de:`Feld '${e.key}' (docRef) kann nicht exportiert werden \u2014 ein Speicher-Handle ist kein bindbarer Dokumentwert.`,en:`Field '${e.key}' (docRef) cannot be exported \u2014 a storage handle is not a bindable document value.`}}),e.multiple===!0&&t.push({severity:"error",path:n,code:"export.multiple-enum",message:{de:`Feld '${e.key}' ist eine Mehrfachauswahl \u2014 N gew\xE4hlte Optionen sind kein einzelnes zusammengesetztes Blatt, deshalb nicht exportierbar.`,en:`Field '${e.key}' is a multi-select \u2014 N picked options are not one compound leaf, so it cannot be exported.`}}),t}s(fK,"exportGateIssues");function Xa(e,n,t,r,i){e.has(n)?i.push({severity:"error",path:t,code:r,message:{de:`Mehrfach vergeben: ${pK(r,"de")} '${n}'`,en:`Duplicate ${pK(r,"en")}: '${n}'`}}):e.add(n)}s(Xa,"reportIfDup");function pK(e,n){let t=s((r,i)=>n==="de"?r:i,"label");switch(e){case"duplicate.section-id":return t("Abschnitts-ID","section id");case"duplicate.field-key":return t("Feldschl\xFCssel","field key");case"duplicate.effect-id":return t("Effekt-ID","effect id");case"duplicate.outcome-id":return t("Ergebnis-ID","outcome id");case"ref.unknown-required-for-outcome":return t("requiredFor-Ergebnis","requiredFor outcome");default:return e}}s(pK,"labelForCode");function hS(e,n,t,r,i,o){e.visibleIf&&(Cr(e.visibleIf,`${n}.visibleIf`,t,r,o),el(e.visibleIf,`${n}.visibleIf`,i,o)),e.requiredIf&&(Cr(e.requiredIf,`${n}.requiredIf`,t,r,o),el(e.requiredIf,`${n}.requiredIf`,i,o)),e.disabledIf&&(Cr(e.disabledIf,`${n}.disabledIf`,t,r,o),el(e.disabledIf,`${n}.disabledIf`,i,o)),e.defaultValue&&Cr(e.defaultValue,`${n}.defaultValue`,t,r,o)}s(hS,"checkFieldAsts");function gS(e){return{hasDefault:e.defaultValue!=null,isBoolean:e.type==="boolean",isYesNo:e.type==="boolean"&&e.presentation==="yesNo",isConsent:e.type==="consent"}}s(gS,"gatingMeta");function el(e,n,t,r){function i(o){switch(o.kind){case"binary":{(o.op==="=="||o.op==="!=")&&(mK(o.left,o.right,o.op,n,t,r),mK(o.right,o.left,o.op,n,t,r)),i(o.left),i(o.right);return}case"unary":i(o.operand);return;case"if":i(o.cond),i(o.then),i(o.else);return;case"call":o.args.forEach(i);return;case"arr":o.items.forEach(i);return;default:return}}s(i,"walk"),i(e)}s(el,"checkGatingExpr");function mK(e,n,t,r,i,o){if(e.kind!=="ident")return;let a=i.get(e.path);if(a){if(a.isConsent&&n.kind==="bool"&&n.value===!1){o.push({severity:"error",path:r,code:"expr.consent-compare-false",message:{de:`Gating-Ausdruck vergleicht die Zustimmung '${e.path}' mit false \u2014 eine Zustimmung ist true oder leer, nie false. '${e.path} != true' verwenden.`,en:`Gating expression compares the consent '${e.path}' to false \u2014 a consent is true or empty, never false. Use '${e.path} != true'.`}});return}a.isBoolean&&(a.hasDefault||n.kind!=="null"&&n.kind==="bool"&&(a.isYesNo&&t==="=="||o.push({severity:"error",path:r,code:"expr.gating-compare-undefaulted-field",message:{de:`Gating-Ausdruck vergleicht das Boolean-Feld '${e.path}' ohne Standardwert per '${t}' mit einem Bool-Literal. In dreiwertiger Logik ist 'undefined ${t} ${n.value}' ${t==="=="?"false":"true"} \u2014 das Gate greift stillschweigend bei ungesetzten Werten. Dem Feld '${e.path}' einen 'defaultValue' geben (oder den Ausdruck umschreiben \u2014 z. B. '${e.path} != null' als ausdr\xFCckliche Gesetzt-Pr\xFCfung).`,en:`Gating expression compares undefaulted boolean field '${e.path}' to a bool literal via '${t}'. In three-valued logic, 'undefined ${t} ${n.value}' is ${t==="=="?"false":"true"} \u2014 the gate fires silently for unset values. Add a 'defaultValue' to field '${e.path}' (or rewrite the expression \u2014 e.g. '${e.path} != null' for an explicit set-check).`}})))}}s(mK,"inspectEqualityOperand");function Cr(e,n,t,r,i){i.push(...AC(e,t.declaredContext,n)),i.push(...mm(e,t.stageKeys,n));for(let o of Ln(e))t.known.has(o)||Kk(o)||r&&o.startsWith("$item.")||i.push({severity:"error",path:n,code:"ref.unknown-ident",message:{de:o.startsWith("$")?`Bezeichner '${o}' ist kein Geltungsbereich, den ein Formular liest \u2014 Umgebungsvariablen sind '$env.<key>.<field>', Wiederholungszeilen '$item.*'.`:`Bezeichner '${o}' ist weder als Feld, berechneter Schl\xFCssel noch als $item-Slot deklariert.`,en:o.startsWith("$")?`Identifier '${o}' is no scope a form reads \u2014 environment variables are '$env.<key>.<field>', repeated rows '$item.*'.`:`Identifier '${o}' is not declared as a field, computed key, or $item slot.`}})}s(Cr,"checkAst");function hK(e,n,t,r){let i=[];e.nameFrom!==void 0&&i.push({severity:"error",path:`${t}.nameFrom`,code:"person.name-from-removed",message:{de:`Effekt '${e.id}': eine Person hat kein nameFrom mehr \u2014 ihr Name ist die Feldzuordnung (fieldMap) auf ${Nr.firstName} / ${Nr.lastName}. nameFrom entfernen.`,en:`Effect '${e.id}': a person has no nameFrom any more \u2014 its name is the fieldMap onto ${Nr.firstName} / ${Nr.lastName}. Remove nameFrom.`}});let o=iK(e.id,n);sK(o)||i.push({severity:"error",path:t,code:"person.without-name-mapping",message:{de:`Effekt '${e.id}': keine Feldzuordnung (fieldMap) auf ${Nr.firstName} oder ${Nr.lastName} \u2014 die Person bek\xE4me keinen Namen.`,en:`Effect '${e.id}': no fieldMap onto ${Nr.firstName} or ${Nr.lastName} \u2014 the person would get no name.`}});for(let a of oK(o))r(a)||i.push({severity:"error",path:t,code:"ref.unknown-name-field",message:{de:`Effekt '${e.id}': der Name wird aus '${a}' gelesen, das kein eingegebenes Feld ist.`,en:`Effect '${e.id}': its name is read from '${a}', which is not an entered field.`}});return i}s(hK,"personNameIssues");function v9(e,n){let t=[],r=e.required===!0||e.requiredIf!==void 0;return e.type==="consent"&&(e.defaultValue!=null&&t.push({severity:"error",path:n,code:"config.consent-default",message:{de:`Feld '${e.key}' ist eine Zustimmung mit einem defaultValue \u2014 zustimmen muss die Familie selbst. Den defaultValue entfernen.`,en:`Field '${e.key}' is a consent with a defaultValue \u2014 the family must give it themselves. Remove the defaultValue.`}}),e.sameAs!==void 0&&t.push({severity:"error",path:n,code:"config.consent-computed",message:{de:`Feld '${e.key}' ist eine Zustimmung, die ein anderes Feld spiegelt (sameAs) \u2014 zustimmen muss die Familie selbst. sameAs entfernen.`,en:`Field '${e.key}' is a consent mirroring another field (sameAs) \u2014 the family must give it themselves. Remove sameAs.`}}),r||t.push({severity:"error",path:n,code:"config.consent-not-required",message:{de:`Feld '${e.key}' ist eine Zustimmung, die nie verlangt wird \u2014 required: true oder requiredIf setzen, sonst Typ 'boolean' verwenden.`,en:`Field '${e.key}' is a consent nobody is asked to give \u2014 set required: true or requiredIf, or use type 'boolean'.`}})),e.type==="boolean"&&r&&e.defaultValue?.trim()==="false"&&t.push({severity:"warning",path:n,code:"config.boolean-required-default-false",message:{de:`Feld '${e.key}' ist ein Ja/Nein-Pflichtfeld, vorbelegt mit Nein \u2014 es gilt von Anfang an als ausgef\xFCllt. Ist es eine Zustimmung, Typ 'consent' verwenden.`,en:`Field '${e.key}' is a required yes/no preset to No \u2014 it counts as answered from the start. If it is a consent, use type 'consent'.`}}),t}s(v9,"consentConfigIssues");function x9(e,n){let t=e.exclusiveOptions;if(t===void 0)return[];let r=s((a,l)=>[{severity:"error",path:n,code:"config.exclusive-options",message:{de:a,en:l}}],"refuse");if(e.type!=="enum"||e.multiple!==!0)return r(`Feld '${e.key}' setzt exclusiveOptions ohne Mehrfachauswahl \u2014 exklusive Optionen gibt es nur bei type: 'enum' mit multiple: true.`,`Field '${e.key}' sets exclusiveOptions without a multi-select \u2014 exclusive options exist only on type: 'enum' with multiple: true.`);if(e.enumListKey!==void 0)return r(`Feld '${e.key}' setzt exclusiveOptions auf einer Liste des Mandanten (enumListKey) \u2014 exklusive Optionen brauchen eigene enumOptions.`,`Field '${e.key}' sets exclusiveOptions on a tenant list (enumListKey) \u2014 exclusive options need inline enumOptions.`);if(!Array.isArray(t)||t.length===0||t.some(a=>typeof a!="string"))return r(`Feld '${e.key}' setzt exclusiveOptions auf ${JSON.stringify(t)} \u2014 erwartet ist eine nicht leere Liste von Optionsschl\xFCsseln.`,`Field '${e.key}' sets exclusiveOptions to ${JSON.stringify(t)} \u2014 it must be a non-empty list of option keys.`);let i=e.enumOptions??[],o=t.filter(a=>!i.includes(a));return o.length>0?r(`Feld '${e.key}' nennt in exclusiveOptions ${o.map(a=>`'${a}'`).join(", ")} \u2014 keine Option des Feldes.`,`Field '${e.key}' names ${o.map(a=>`'${a}'`).join(", ")} in exclusiveOptions \u2014 not an option of the field.`):new Set(t).size!==t.length?r(`Feld '${e.key}' nennt eine Option in exclusiveOptions doppelt.`,`Field '${e.key}' names an option twice in exclusiveOptions.`):[]}s(x9,"exclusiveOptionIssues");var S9="blocked";function kK(e,n){let t={values:n};for(let r of e.outcomes){let i;try{i=kn(r.when,t)}catch(o){F(`resolveActiveOutcome: outcome "${r.id}" when-expression threw: ${o instanceof Error?o.message:String(o)}`,{cause:o})}if(A9(i))return r.id===S9?null:r.id}return null}s(kK,"resolveActiveOutcome");function A9(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(A9,"truthy");function bK(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}s(bK,"isScalar");function E9(e,n,t){for(let[r,i]of Object.entries(e))if(i!==void 0){if(bK(i)){n[r]=i;continue}if(Array.isArray(i)){n[r]=i;continue}for(let[o,a]of Object.entries(i))bK(a)&&(n[`${r}.${o}`]=a)}T9(e,n,t)}s(E9,"mergeRecord");function T9(e,n,t){let r=new Set(t);for(let i of Object.keys(e)){let o=i.indexOf("[");if(o<=0)continue;let a=i.slice(0,o);go(a).test(i)&&r.add(a)}for(let i of r){let o=fS(e,i),a=0;for(let l=0;l<o;l++)Qq(e,i,l)&&a++;n[`${i}.count`]=a}}s(T9,"mergeRepeatedCounts");function vK(e,n,t){let r={...t};return E9(e,r,n),r}s(vK,"flattenValues");function yS(e,n,t){return{code:e,fieldKey:n,text:t}}s(yS,"submitIssue");function xK(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(xK,"truthyEval");function SK(e){if(e==null)return!0;if(typeof e=="string")return e.trim()==="";if(Array.isArray(e))return e.length===0;if(typeof e=="object"){let n=e;if("storageId"in n)return!(typeof n.storageId=="string"&&n.storageId.trim()!=="");let t=n;return!t.street?.trim()||!t.hausnr?.trim()||!t.plz?.trim()||!t.ort?.trim()||!t.land?.trim()}return!1}s(SK,"isEmptyValue");function R9(e,n,t){let r=!!e.required;if(!r&&e.requiredIf)try{r=xK(kn(e.requiredIf,{values:n}))}catch{r=!1}return r?e.requiredFor?t===null?!1:e.requiredFor.includes(t):!0:!1}s(R9,"fieldIsLiveRequired");function $9(e,n,t){return AK(e,n,t).evalCtx}s($9,"buildSubmitEvalContext");function AK(e,n,t){let r=I9(e),i=Object.keys(n).filter(l=>r(l)!==null),o=new Set(i),a=new Set;for(;;){let l={};for(let[y,k]of Object.entries(n))(r(y)===null||o.has(y))&&(l[y]=k);let d=EK(e,l,t),c=new Set,u=new Set;RK(e,d,y=>c.add(y.key),y=>u.add(y.key));let p=new Set(i.filter(y=>{let k=r(y);return k.kind==="field"?c.has(y):u.has(k.repeatedKey)}));if(p.size===o.size&&[...p].every(y=>o.has(y))){let y={};for(let k of i)o.has(k)||(y[k]=n[k]);return{visible:l,hidden:y,evalCtx:d}}let h=[...p].sort().join("\0");if(a.has(h)){let y=i.filter(k=>p.has(k)!==o.has(k));F(`[smartForm] visibility of ${y.join(", ")} does not settle \u2014 each depends on whether the other's value counts. The form's visibleIf conditions are contradictory.`)}a.add(h),o=p}}s(AK,"splitWithContext");function I9(e){let n=new Map,t=[];for(let r of zh(e.sections)){for(let i of r.fields)n.set(i.key,i);for(let i of r.groups??[])for(let o of i.fields)n.set(o.key,o);for(let i of r.repeated??[])t.push({key:i.key,pattern:go(i.key),items:new Map(i.itemTemplate.map(o=>[o.key,o]))})}return r=>{let i=n.get(r);if(i!==void 0)return{kind:"field",field:i};for(let o of t){let a=o.pattern.exec(r);if(a!==null)return{kind:"row",repeatedKey:o.key,field:o.items.get(a[2])}}return null}}s(I9,"fieldOwnership");function EK(e,n,t){let r=[];for(let o of zh(e.sections))for(let a of o.repeated??[])r.push(a.key);let i=vK(n,r,t);for(let o of zh(e.sections))for(let a of o.computed??[])try{i[a.key]=kn(a.expression,{values:i})}catch{}return i}s(EK,"rawEvalContext");function TK(e,n,t){let{values:r,defaulted:i}=O9(e,n,t),o=AK(e,r,t),a={};for(let[l,d]of Object.entries(o.hidden))i.has(l)||(a[l]=d);return{...o,hidden:a}}s(TK,"splitDraftValues");function O9(e,n,t,r){let i={...n},o=new Set,a=null;for(let l of zh(e.sections))for(let d of[...l.fields,...(l.groups??[]).flatMap(c=>c.fields)]){if(!d.defaultValue||n[d.key]!=null||r?.(d.key))continue;a??=EK(e,n,t);let c;try{c=kn(d.defaultValue,{values:a})}catch(u){F(`[smartForm] defaultValue of '${d.key}' does not evaluate: ${u instanceof Error?u.message:String(u)}`)}c!=null&&(i[d.key]=c,o.add(d.key))}return{values:i,defaulted:o}}s(O9,"applyFieldDefaults");function zh(e){let n=[],t=s(r=>{n.push(r);for(let i of r.subsections??[])t(i)},"walk");for(let r of e)t(r);return n}s(zh,"walkSectionsDeep");function _9(e,n,t,r=!1){if(SK(n))return null;let i=t.fields[e.type];i||F(`[fieldFormatIssue] no field provider registered for type "${e.type}" (field "${e.key}"). Register it in the domain form registry.`);let o=i.validate(e,n,{state:{values:{},computed:{}},testMode:r});return o.length>0?o[0].message:null}s(_9,"fieldFormatIssue");function P9(e,n){return SK(n)||e.type==="consent"&&n!==!0}s(P9,"isUnanswered");function Gh(e,n){if(!e)return!0;try{return xK(kn(e,{values:n}))}catch{return!1}}s(Gh,"isVisibleUnder");function RK(e,n,t,r){let i=s(o=>{if(Gh(o.visibleIf,n)){for(let a of o.fields)Gh(a.visibleIf,n)&&t(a);for(let a of o.groups??[])if(Gh(a.visibleIf,n))for(let l of a.fields)Gh(l.visibleIf,n)&&t(l);if(r!==void 0)for(let a of o.repeated??[])r(a);for(let a of o.subsections??[])i(a)}},"walk");for(let o of e.sections)i(o)}s(RK,"forEachVisibleField");function $K(e,n,t,r={}){let i=$9(e,n,t),o=[],a=kK(e,i);a===null&&r.requireOutcome!==!1&&o.push(yS("no-outcome",null,{de:"Die Angaben ergeben keinen g\xFCltigen Abschluss \u2014 bitte pr\xFCfen Sie das Formular.",en:"The answers do not lead to a valid outcome \u2014 please check the form."}));let l=new Set(r.exemptFromRequired??[]);return RK(e,i,d=>{let c=n[d.key];if(P9(d,c)){!l.has(d.type)&&R9(d,i,a)&&o.push(yS("required",d.key,Ul([d.label],([p],h)=>h==="de"?`${p} ist ein Pflichtfeld.`:`${p} is a required field.`)));return}if(!r.registry)return;let u=_9(d,c,r.registry,r.testMode===!0);u!==null&&o.push(yS("format",d.key,u))}),{issues:o,activeOutcome:a,evalCtx:i,submittable:o.length===0}}s($K,"checkSubmittable");function OK(){return[...Be,null].flatMap(n=>fw.map(t=>({language:n,channel:t})))}s(OK,"applicantVariants");function _K(e,n){let t=new Map;for(let r of e){let i={};for(let a of n)r[a]===void 0&&F(`[scenario/environment] the host supplied no "${a}"`),i[a]=r[a];let o=JSON.stringify(n.map(a=>i[a]));t.has(o)||t.set(o,i)}return[...t.values()]}s(_K,"projectEnvironments");var IK={"self-service":{de:"online",en:"online"},staff:{de:"durch die Schule",en:"by the school"}};function PK(e){let n=[];for(let t of[e.offer?.title,e.unit?.name,e.stage?.name,e.run?.name])t!==void 0&&n.push({de:t,en:t});if(e.applicant){let{language:t,channel:r}=e.applicant;n.push({de:`${t===null?"ohne Konto":`Konto ${t}`}, ${IK[r].de}`,en:`${t===null?"no account":`account ${t}`}, ${IK[r].en}`})}return{de:n.map(t=>t.de).join(" \xB7 "),en:n.map(t=>t.en).join(" \xB7 ")}}s(PK,"describeEnvironment");var NK=6;function CK(e,n){let t=e.slice(0,NK).map(i=>i[n]).join("; "),r=e.length-NK;return r<=0?t:n==="de"?`${t} und ${r} weitere`:`${t} and ${r} more`}s(CK,"listed");function DK(e,n){let t=e.testScenarios??[];if(t.length===0)return[];let r=SC(e).filter(Ji),i=r.length===0?[{}]:n??[];if(r.length>0&&n===void 0)return[{severity:"warning",path:"testScenarios",code:"scenario.unjudged",message:{de:`Die Testszenarien werden hier nicht gepr\xFCft: das Formular liest ${r.join(", ")}, und welche Klassenstufen und Schuljahre das Angebot hat, ist hier nicht bekannt \u2014 die Ver\xF6ffentlichung pr\xFCft sie.`,en:`The test scenarios are not judged here: the form reads ${r.join(", ")}, and which grades and school years the offer has is not known here \u2014 publishing judges them.`}}];if(i.length===0)return[{severity:"warning",path:"testScenarios",code:"scenario.no-environment",message:{de:"Das Angebot hat noch keine Klassenstufe mit Schuljahr \u2014 die Testszenarien sind gegen keine Umgebung gepr\xFCft. Nach dem Anlegen erneut ver\xF6ffentlichen.",en:"The offer has no grade with a school year yet \u2014 the test scenarios are judged against no environment. Publish again once one exists."}}];let{compiled:o}=$a(e),a=[];for(let l of t){let d=l.prefill??{},c=new Map,u=s((p,h)=>{let y=`${p.path}\0${p.message.de}`,k=c.get(y);k===void 0?c.set(y,{...p,where:[h]}):k.where.some(w=>w.de===h.de)||k.where.push(h)},"add");for(let p of i){let h=xC(p,r),{visible:y}=TK(o,d,h),k=$K(o,y,h,{exemptFromRequired:["docRef"]}),w=PK(p);for(let b of k.issues){if(b.code==="no-outcome"){u({path:`scenario:${l.id}`,code:"scenario.no-outcome",message:{de:`Szenario "${l.label.de}" erreicht kein g\xFCltiges Outcome \u2013 der Testfall ist nicht absendbar.`,en:`Scenario "${l.label.en}" reaches no valid outcome \u2013 the test case cannot be submitted.`}},w);continue}if(b.code==="required"){u({path:`scenario:${l.id}/${b.fieldKey}`,code:"scenario.required-field-unfilled",message:{de:`Szenario "${l.label.de}" l\xE4sst das Pflichtfeld ${b.fieldKey} unbef\xFCllt \u2013 kein g\xFCltiges Outcome.`,en:`Scenario "${l.label.en}" leaves the required field ${b.fieldKey} empty \u2013 no valid outcome.`}},w);continue}u({path:`scenario:${l.id}/${b.fieldKey}`,code:"scenario.invalid-value",message:Ul([l.label,b.text],([T,E],$)=>$==="de"?`Szenario "${T}": ${E}`:`Scenario "${T}": ${E}`)},w)}}for(let p of c.values())a.push({severity:"error",path:p.path,code:p.code,message:r.length===0?p.message:{de:`${p.message.de} \u2014 in: ${CK(p.where,"de")}`,en:`${p.message.en} \u2014 in: ${CK(p.where,"en")}`}})}return a}s(DK,"validateScenarios");function Wh(e){return e.filter(n=>(n.severity??"error")==="error")}s(Wh,"blockingIssues");function Yh(e,n={}){return[...gK(e,n),...DK(e,n.scenarioEnvironments)]}s(Yh,"runFormValidators");function Hh(e){return Wh(e)}s(Hh,"blockingFormErrors");function FK(e,n,t){return FD(e,n,t)}s(FK,"runWorkflowValidators");function LK(e){return Wh(e)}s(LK,"blockingWorkflowErrors");var N9=["actionTeams","artifacts","assign","inputs","library","next","notifications","optionalActions","outcomes","outputLabels","sublabel","tasks"];var MK={join:{required:[],optional:[]},end:{required:[],optional:[]},eventTrigger:{required:[],optional:[]},form:{required:[],optional:["adoptForm","formExports"]},roleAssign:{required:[],optional:[]},setFlag:{required:[],optional:[]},if:{required:["condition"],optional:[]},countersign:{required:["contract"],optional:["signing","titles"]},engagePush:{required:["form"],optional:["contract","engage","payment"]},decision:{required:[],optional:["commentRequired","decisionAsTask","reads","requiresOneOf","view"]},review:{required:[],optional:["commentRequired","decisionAsTask","form"]},waitlist:{required:[],optional:[]},completenessCheck:{required:["deadline","requires"],optional:[]},collectPayment:{required:[],optional:[]},governedDocument:{required:["approval","production","responseStrategy"],optional:["confirmBeforeIssue","confirmContractTerms","contractTermsQuestionText","form","generatorStamp","reads","responseLabels","templateStamp","titles"]}},St={id:m.string(),label:$i,actionTeams:m.optional(m.any()),artifacts:m.optional(m.any()),assign:m.optional(m.any()),inputs:m.optional(m.any()),library:m.optional(m.any()),next:m.optional(m.any()),notifications:m.optional(m.any()),optionalActions:m.optional(m.any()),outcomes:m.optional(m.any()),outputLabels:m.optional(m.any()),sublabel:m.optional(m.any()),tasks:m.optional(m.any())},C9=m.object({...St,type:m.literal("join")}),D9=m.object({...St,type:m.literal("end")}),F9=m.object({...St,type:m.literal("eventTrigger")}),L9=m.object({...St,type:m.literal("form"),adoptForm:m.optional(m.any()),formExports:m.optional(m.any())}),M9=m.object({...St,type:m.literal("roleAssign")}),q9=m.object({...St,type:m.literal("setFlag")}),K9=m.object({...St,type:m.literal("if"),condition:m.optional(m.any())}),j9=m.object({...St,type:m.literal("countersign"),contract:m.optional(m.any()),signing:m.optional(m.any()),titles:m.optional(m.any())}),V9=m.object({...St,type:m.literal("engagePush"),contract:m.optional(m.any()),engage:m.optional(m.any()),form:m.optional(m.any()),payment:m.optional(m.any())}),B9=m.object({...St,type:m.literal("decision"),commentRequired:m.optional(m.any()),decisionAsTask:m.optional(m.any()),reads:m.optional(m.any()),requiresOneOf:m.optional(m.any()),view:m.optional(m.any()),formView:m.optional(m.any())}),U9=m.object({...St,type:m.literal("review"),commentRequired:m.optional(m.any()),decisionAsTask:m.optional(m.any()),form:m.optional(m.any())}),G9=m.object({...St,type:m.literal("waitlist")}),z9=m.object({...St,type:m.literal("completenessCheck"),deadline:m.optional(m.any()),requires:m.optional(m.any())}),W9=m.object({...St,type:m.literal("collectPayment")}),Y9=m.object({...St,type:m.literal("governedDocument"),approval:m.optional(m.any()),confirmBeforeIssue:m.optional(m.any()),confirmContractTerms:m.optional(m.any()),contractTermsQuestionText:m.optional(m.any()),form:m.optional(m.any()),generatorStamp:m.optional(m.any()),production:m.optional(m.any()),reads:m.optional(m.any()),responseLabels:m.optional(m.any()),responseStrategy:m.optional(m.any()),templateStamp:m.optional(m.any()),titles:m.optional(m.any())}),vje=m.union(C9,D9,F9,L9,M9,q9,K9,j9,V9,B9,U9,G9,z9,W9,Y9);function qK(e){let n=[];return e.forEach((t,r)=>{if(t===null||typeof t!="object"||Array.isArray(t)){n.push(`graph.nodes[${r}]: a node must be an object`);return}let i=t,o=`graph.nodes[${r}]${typeof i.id=="string"?` (${i.id})`:""}`;(typeof i.id!="string"||i.id==="")&&n.push(`${o}: \`id\` must be a non-empty string`);let a=i.type;if(typeof a!="string"||!(a in MK)){n.push(`${o}: unknown node type ${JSON.stringify(a)}`);return}let l=MK[a],d=new Set(["id","type","label",...N9,...l.required,...l.optional]);for(let c of Object.keys(i))d.has(c)||n.push(`${o}: \`${c}\` is not a field of a ${a} node. Delete the line.`)}),n}s(qK,"workflowNodeEnvelopeIssues");var KK=s(e=>e,"asEffectId"),yo=s(e=>e,"asOutcomeId"),nl=s(e=>e,"asSectionId"),pt=s(e=>e,"asFieldKey");var Dr=["string","boolean","consent","date","enum","email","tel","address","docRef"],wc=["person","organization","relationship","fieldMap"],wo=["auto-on-any-write","auto-on-required-complete","workflow-explicit"],tl=["fresh","keyed","manual"];function ws(e,n,t,r){if(e===void 0||e===""){if(n!==void 0&&n!=="")throw new Error(`${t}: ${r}-en needs ${r} too`);return}return dn(e,n,t,r)}s(ws,"optionalLocalizedText");function tt(e,n){if(!(e===void 0||e===""))try{Fn(e)}catch(t){throw new Error(`offer form: ${n} is not a valid expression: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}s(tt,"assertExpression");function kc(e){return Object.keys(e.smartforms??{})}s(kc,"carriedFormSlugs");function wS(e){let t=e.workflow?.graph?.nodes??[],r=[];for(let i of t){if(i.type!=="form")continue;let o=i.inputs?.smartForm;o?.kind==="literal"&&typeof o.value=="string"&&o.value&&r.push(o.value)}return r}s(wS,"boundFormSlugs");function Jh(e,n){let t=kc(e);if(n){if(!t.includes(n))throw new Error(`offer form: no smartform "${n}" in this bundle (have: ${t.join(", ")||"none"})`);return n}if(t.length===0)throw new Error("offer form: bundle carries no smartforms \u2014 run `offer form add` first");if(t.length>1)throw new Error(`offer form: bundle carries ${t.length} smartforms \u2014 pass --form <key> (one of: ${t.join(", ")})`);return t[0]}s(Jh,"resolveFormSlug");function Qh(e,n){let t=e.smartforms?.[n];if(!t)throw new Error(`offer form: smartform "${n}" not found in bundle`);return t}s(Qh,"getForm");function Jt(e){let n=[],t=s(r=>{n.push(r),r.subsections?.forEach(i=>t(i))},"visit");return e.sections.forEach(t),n}s(Jt,"walkSections");function pr(e,n){return Jt(e).find(t=>t.id===n)}s(pr,"findSection");function ks(e,n){for(let t of Jt(e)){let r=t.fields.findIndex(i=>i.key===n);if(r>=0)return{section:t,field:t.fields[r],index:r}}}s(ks,"findField");function bs(e){let n=new Set;for(let t of Jt(e))t.fields.forEach(r=>n.add(r.key)),t.groups?.forEach(r=>r.fields.forEach(i=>n.add(i.key))),t.repeated?.forEach(r=>r.itemTemplate.forEach(i=>n.add(i.key))),t.computed?.forEach(r=>n.add(r.key));return n}s(bs,"allFieldKeys");function H9(e){let n=dn(e.label,e.labelEn,"offer form add"),t={id:nl("section.allgemein"),label:{de:"Allgemein",en:"General"},fields:[]},r={id:yo("standard"),label:{de:"Standard",en:"Standard"},when:"true",output:{includeForm:!0}};return{label:n,sections:[t],effects:[],outcomes:[r]}}s(H9,"buildSkeletonSmartForm");function Zh(e,n){let{key:t,label:r}=n;if(kc(e).includes(t))throw new Error(`offer form add: smartform "${t}" already exists in this bundle`);let i=H9({key:t,label:r,...n.labelEn?{labelEn:n.labelEn}:{}});e.smartforms={...e.smartforms??{},[t]:i},e.index.smartforms={...e.index.smartforms??{},[t]:{}}}s(Zh,"addForm");function jK(e,n){if(!kc(e).includes(n))throw new Error(`offer form rm: smartform "${n}" not found in bundle`);if(wS(e).includes(n))throw new Error(`offer form rm: smartform "${n}" is still bound by a form node \u2014 remove the form node first (offer workflow node rm), then the form`);return delete e.smartforms[n],e.index.smartforms&&delete e.index.smartforms[n],n}s(jK,"removeForm");function VK(e,n){let t=Qh(e,n.slug);if(n.label===void 0&&n.labelEn===void 0)throw new Error("offer form set: nothing to change \u2014 pass --label/--label-en");if(n.label==="")throw new Error("offer form set: --label cannot be empty");vn(t,"label",{de:n.label,en:n.labelEn},"offer form set")}s(VK,"setForm");function BK(e,n){let t=e.workflow?.graph?.nodes;if(!Array.isArray(t))throw new Error(`${n}: the bundle carries no workflow graph (workflow.json)`);return t}s(BK,"nodesOf");function UK(e,n,t){let r=BK(e,t),i=r.find(o=>o.id===n);if(i===void 0)throw new Error(`${t}: no node "${n}" (nodes: ${r.map(o=>o.id).join(", ")})`);return i}s(UK,"nodeOf");function GK(e){return e.flatMap(n=>{if(n.type!=="form"||Ot(n))return[];let t=n.inputs?.smartForm;return t?.kind==="literal"&&typeof t.value=="string"&&t.value!==""?[{node:n,slug:t.value}]:[]})}s(GK,"creatingFormNodes");function zK(e){return Hh(Yh(e)).map(n=>`[${n.code??"form"}] ${n.path?`${n.path}: `:""}${n.message.de}`)}s(zK,"formErrors");function Xh(e){let n="offer workflow restamp-exports",t=BK(e,n),r=[];for(let{node:i,slug:o}of GK(t)){let a=e.smartforms?.[o];if(a===void 0)throw new Error(`${n}: form node "${i.id}" binds smartForm "${o}", but the bundle carries no smartforms/${o}.json`);let l=a,d=zK(l);if(d.length>0)throw new Error(`${n}: smartform "${o}" is refused by the publish gate \u2014 fix it first:
|
|
11683
11683
|
${d.join(`
|
|
11684
11684
|
`)}`);let c=ck(l),u=Array.isArray(i.formExports)?i.formExports.map(h=>h.key):null,p=i.formExports===void 0||Pe(i.formExports)!==Pe(c);i.formExports=c,r.push({node:i.id,form:o,before:u,after:c.map(h=>h.key),changed:p})}for(let i of t)if(i.type==="form"&&Ot(i)&&"formExports"in i){let o=i.formExports?.map(a=>a.key)??null;delete i.formExports,r.push({node:i.id,form:"(adoptForm)",before:o,after:[],changed:!0})}return r}s(Xh,"restampFormExports");function WK(e){let n=e.workflow?.graph?.nodes??[];return GK(n).flatMap(({node:t,slug:r})=>{if(t.formExports===void 0)return[];let i=e.smartforms?.[r];if(i===void 0)return[];let o=i;return zK(o).length>0?[]:Pe(t.formExports)===Pe(ck(o))?[]:[{node:t.id,form:r}]})}s(WK,"staleFormExports");var kS=["string","number","boolean","date"];function YK(e,n){let t="offer form field export";for(let r of Jt(e)){let i=[...r.fields,...(r.groups??[]).flatMap(a=>a.fields)].find(a=>a.key===n.key);if(i!==void 0){if(n.type!==void 0)throw new Error(`${t}: --type is for a computed field; "${n.key}" is an entered ${i.type} field and exports as its own type`);if(n.on&&!Bp(i.type))throw new Error(`${t}: "${n.key}" is a ${i.type} field \u2014 that type has no exported value (export.invalid-type)`);if(n.on&&i.multiple===!0)throw new Error(`${t}: "${n.key}" is a multi-select \u2014 N picked options are no single leaf (export.multiple-enum)`);let a=i.export===!0,l=i;return n.on?l.export=!0:delete l.export,{kind:"field",before:a,after:n.on}}let o=(r.computed??[]).find(a=>a.key===n.key);if(o!==void 0){let a=o.export===!0,l=o;if(!n.on){if(n.type!==void 0)throw new Error(`${t}: --type goes with an export, not with --off`);return delete l.export,delete l.exportType,{kind:"computed",before:a,after:!1}}let d=n.type??o.exportType;if(d===void 0)throw new Error(`${t}: "${n.key}" is a computed field \u2014 name its type with --type (${kS.join("|")}); an expression has none to infer`);if(!kS.includes(d))throw new Error(`${t}: --type "${d}" is no computed export type (${kS.join("|")})`);return l.export=!0,l.exportType=d,{kind:"computed",before:a,after:!0}}if((r.repeated??[]).some(a=>a.itemTemplate.some(l=>l.key===n.key)))throw new Error(`${t}: "${n.key}" sits in a repeated block \u2014 a row value is no per-application leaf (export.in-repeated)`)}throw new Error(`${t}: the form has no field "${n.key}"`)}s(YK,"setFieldExport");function HK(e,n,t){let r="offer workflow node set-generator",i=UK(e,n,r);if(Kh(i)!=="resolver")throw new Error(`${r}: "${n}" generates no contract from a generator (${i.type==="governedDocument"?`production ${String(i.production)}`:String(i.type)}) \u2014 a pin belongs on a governedDocument with production resolver`);let a=t.key.trim();if(a==="")throw new Error(`${r}: the ${t.kind} key is empty`);let l=mi(i),d=l!==null&&l.key===a&&l.kind===t.kind&&l.revision===void 0,c=!d&&"generatorStamp"in i;c&&delete i.generatorStamp,i.inputs={...i.inputs??{},[Qn]:{kind:"literal",value:{kind:t.kind,key:a}}};let u=d?[]:Object.keys(i.inputs).filter(p=>p!==Qn&&p!==Bt);return{before:l,after:{key:a,kind:t.kind},droppedStamp:c,keptParameterCells:u}}s(HK,"setGeneratorPin");function JK(e,n,t){let r="offer workflow node set-cockpit-fields",i=UK(e,n,r),o=Kh(i);if(o!=="resolver"&&o!=="template")throw new Error(`${r}: "${n}" fills no document from a generator or a Word template (${i.type==="governedDocument"?`production ${String(i.production)}`:String(i.type)})`);if(!(o==="resolver"?mi(i)!==null:Er(i)!==null))throw new Error(o==="resolver"?`${r}: "${n}" names no generator yet \u2014 name one first (offer workflow node set-generator)`:`${r}: "${n}" names no Word template yet \u2014 name one first (inputs.documentTemplate)`);let l=new Set;for(let p of t){if(l.has(p))throw new Error(`${r}: --fields names "${p}" twice`);l.add(p)}let d={...i.inputs??{}},c=Object.keys(d).filter(p=>d[p]?.kind==="cockpit"),u=t.flatMap(p=>{let h=d[p];return h===void 0||h.kind==="cockpit"||h.kind==="unset"?[]:[{field:p,cell:h}]});for(let p of c)l.has(p)||delete d[p];for(let p of t)d[p]={kind:"cockpit"};return i.inputs=d,{pin:o,before:c,after:[...t],replaced:u}}s(JK,"setCockpitFields");var J9=new Set(["graph","progressLayout","progressWiring"]);function QK(e){let{label:n,...t}=e;return t}s(QK,"definitionOf");function Q9(e){let n=[];for(let o of Object.keys(e))J9.has(o)||n.push(`workflow.json: unknown key \`${o}\` \u2014 the file carries only graph, progressLayout, progressWiring. Delete the line.`);let t=e.graph;if(t===null||typeof t!="object"||Array.isArray(t))return n.push("workflow.json: `graph` must be an object."),n;for(let o of Object.keys(t)){if(XO.has(o))continue;let a=o==="id"||o==="label"?" (the title is the offer's, bundle.yaml `label`)":o==="dataFlow"?" (publish derives it)":"";n.push(`workflow.json: \`graph.${o}\` is no longer part of the workflow graph${a}. Delete the line.`)}let r=t;Array.isArray(r.nodes)?n.push(...qK(r.nodes).map(o=>`workflow.json: ${o}`)):n.push("workflow.json: `graph.nodes` must be a list."),r.assignmentRules===void 0&&n.push("workflow.json: `graph.assignmentRules` is required (who becomes responsible).");let i=e.progressWiring;return i!=null&&typeof i=="object"&&"layoutId"in i&&n.push("workflow.json: `progressWiring.layoutId` is no longer part of the wiring (the layout is the workflow's own). Delete the line."),n}s(Q9,"workflowShapeIssues");function ZK(e){let n=e.nodes??[],t=new Map;for(let r of n){let i=V_(r);i!==void 0&&t.set(r.id,i)}return t}s(ZK,"formNodeSlugById");function Z9(e,n){let t=e.smartforms??{},r=new Map;for(let[i,o]of ZK(n)){let a=t[o];if(a===void 0)return;r.set(i,QK(a))}return _C(r)}s(Z9,"readinessContext");function X9(e){return[...ZK(e).values()]}s(X9,"formNodeSlugs");function eg(e){let n=e.code?`[${e.code}] `:"",t=e.path?`${e.path}: `:"",r=e.reason??e.message;return`${n}${t}${r===void 0?JSON.stringify(e):r.de}`}s(eg,"describe");function Ft(e){let n=[];for(let l of gp(e.manifest))n.push({severity:"error",area:"manifest",message:l});let t=Dn(e.index.label);(t==="not-localized"||t.length>0)&&n.push({severity:"error",area:"manifest",message:`[i18n/missingTranslation] bundle.yaml label fehlt in: ${t==="not-localized"?"de, en":t.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`});let{manifest:r,workflow:i}=e.index.slugs;i!==void 0&&i!==r&&n.push({severity:"error",area:"workflow",message:`slugs.workflow '${i}' must equal slugs.manifest '${r}' \u2014 the workflow belongs to the offer family, and export writes the family key`});for(let l of tp(e.index.program?.stages??[]))n.push({severity:"error",area:"program",message:l.message.de});for(let l of np(e.index.program?.runs??[]))n.push({severity:"error",area:"program",message:l.message.de});for(let l of xh(e.index.program?.runs??[],e.index.program?.stages?.map(d=>d.key)))n.push({severity:"error",area:"program",message:l});if(e.workflow!==void 0){for(let T of Q9(e.workflow))n.push({severity:"error",area:"workflow",message:T});let l=e.workflow.graph,d=e.workflow.progressLayout,c=e.workflow.progressWiring;if(d!==void 0)for(let T of ZO(d))n.push({severity:"error",area:"workflow",message:T});let u=[];for(let{node:T,key:E,kind:$}of jh(e))T.generatorStamp?.schemaDigest===void 0&&(u.push(T.id),n.push({severity:"warning",area:"workflow",message:`[resolver/pinNotStamped] Knoten "${T.id}" pinnt ${$}:${E} ohne Stempel \u2014 ob er \u201Econtract\u201C oder \u201Econtracts\u201C liefert und welche Parameter er hat, pr\xFCft erst \`offer plan\` (stempelt den Pin von der Umgebung).`}));for(let T of l.nodes)T.type!=="governedDocument"||T.production!=="template"||T.templateStamp!==void 0||n.push({severity:"warning",area:"workflow",message:`[template/notStamped] Knoten "${T.id}" f\xFCllt die Vorlage ${Er(T)??"\u2014"} ohne ihre Parameter \u2014 welche Felder sie hat, pr\xFCft erst \`offer plan\` (stempelt sie vom Vorlagen-Datensatz der Umgebung).`});for(let{node:T,form:E}of WK(e))n.push({severity:"warning",area:"workflow",message:`[formExports/stale] Knoten "${T}": der Stempel formExports passt nicht mehr zum Formular "${E}" \u2014 die Adresspr\xFCfung liest den alten Stand; \`offer workflow restamp-exports\` stempelt ihn neu (publish tut es ohnehin).`});let p=e.index.program?.stages?.map(T=>T.key),h={...Z9(e,l),...p===void 0?{}:{stageKeys:new Set(p)}},y=s(T=>{let E=FK(T,{layout:d,wiring:c},h),$=new Set(LK(E));return{issues:E,isError:s(C=>$.has(C)||(C.severity??"error")==="error","isError")}},"blockingOf"),{issues:k,isError:w}=y(l),b=new Set;if(u.length>0){let T=structuredClone(l);for(let L of T.nodes)u.includes(L.id)&&(L.generatorStamp={...L.generatorStamp??{},parts:[{partKey:"?"}]});let E=y(T),$=new Set(E.issues.filter(E.isError).map(eg)),C=s(L=>u.some(_=>L.includes(`$node.${_}.contract`)),"namesOutput");for(let L of k){let _=eg(L);w(L)&&!$.has(_)&&C(_)&&b.add(_)}}for(let T of k){let E=eg(T);if(b.has(E)){n.push({severity:"warning",area:"workflow",message:`[resolver/pinNotStamped \u2192 offer plan] ${E}`});continue}n.push({severity:w(T)?"error":"warning",area:"workflow",message:E})}}let o=e.index.program?.stages,a=o===void 0?void 0:new Set(o.map(l=>l.key));for(let[l,d]of Object.entries(e.smartforms??{})){let c=Dn(d.label);(c==="not-localized"||c.length>0)&&n.push({severity:"error",area:"smartform",message:`${l}: [i18n/missingTranslation] \`label\` muss ein zweisprachiger Text ({ de, en }) sein.`});let u=QK(d);for(let w of e_(u,`smartforms/${l}.json`))n.push({severity:"error",area:"smartform",message:w.de});let p=u,h=eX(e,p),y=Yh(p,{stageKeys:a,...h===void 0?{}:{scenarioEnvironments:h}}),k=new Set(Hh(y));for(let w of y)n.push({severity:k.has(w)||w.severity==="error"?"error":"warning",area:"smartform",message:`${l}: ${eg(w)}`});for(let w of[...Yq(p),...Wq(p)])n.push({severity:"error",area:"smartform",message:`${l}: [${w.code}] ${w.path}: ${w.message}`})}if(e.workflow!==void 0){let l=e.workflow.graph,d=new Set(X9(l)),c=new Set(Object.keys(e.smartforms??{}));for(let u of d)c.has(u)||n.push({severity:"error",area:"consistency",message:`form node binds smartForm "${u}" but the bundle carries no smartforms/${u}.json`});for(let u of c)d.has(u)||n.push({severity:"warning",area:"consistency",message:`smartform "${u}" is carried but no form node binds it`})}return n}s(Ft,"validateBundle");function eX(e,n){let t=(n.env??[]).filter(d=>Ji(d));if(t.length===0)return[{}];if(t.includes("offer")||t.includes("unit"))return;let r=e.index.program,i=r?.stages,o=r?.runs;if(t.includes("stage")&&i===void 0||t.includes("run")&&o===void 0)return;let a=t.includes("applicant")?OK():[{language:null,channel:"staff"}],l=[];for(let d of a){let c=d.language??"de",u=s(y=>({key:y.key,name:y.name[c],gradeLevel:y.gradeLevel??null}),"stageOf"),p=s(y=>({key:y.key,name:y.name[c],startDate:y.startDate??null}),"runOf"),h=[];if(i!==void 0&&o!==void 0)for(let y of o){let k=y.capacities===void 0?i:i.filter(w=>y.capacities[w.key]!==void 0);for(let w of k)h.push({stage:u(w),run:p(y)})}else if(i!==void 0)for(let y of i)h.push({stage:u(y)});else if(o!==void 0)for(let y of o)h.push({run:p(y)});else h.push({});for(let y of h)l.push({...y,applicant:d})}return _K(l,t)}s(eX,"bundleScenarioEnvironments");async function bS(e,n,t){let r=jh(t);if(r.length===0)return{rows:[],issues:[]};let i=[...new Map(r.map(({key:c,kind:u,revision:p})=>[`${u}:${c}:${p??"current"}`,{key:c,kind:u,...p===void 0?{}:{revision:p}}])).values()],o=await e.query(x.workflow.getResolverPinStamps,{client:n,unitKey:t.index.links?.unitKey??null,pins:i}).catch(c=>{throw c instanceof Error&&c.message.includes("Could not find public function")?new Error(`offer: ${e.convexUrl} has no workflow:getResolverPinStamps \u2014 that deployment is older than this CLI; release it first (or use a CLI of its release).`,{cause:c}):c}),a=new Map(o.map(c=>[`${c.kind}:${c.key}:${c.revision??"current"}`,c])),l=[],d=[];for(let{node:c,key:u,kind:p,revision:h}of r){let y=a.get(`${p}:${u}:${h??"current"}`);if(y===void 0)throw new Error(`offer: the environment answered no stamp for ${p}:${u}`);if(y.stamp===null){if(y.refusal===null)throw new Error(`offer: the environment answered neither a stamp nor a refusal for ${p}:${u}`);d.push({severity:"error",area:"workflow",message:`[resolver/pinRefused] Knoten "${c.id}": ${y.refusal.de}`});continue}QO(c,structuredClone(y.stamp),{freezeRevision:!0}),l.push({target:`stamp:${c.id}`,detail:y.stamp.parts===void 0?`${p}:${u} Dokument`:`${p}:${u} kombiniert (${y.stamp.parts.map(k=>k.partKey).join(", ")})`})}return{rows:l,issues:d}}s(bS,"stampResolverPins");async function vS(e,n,t){let r=(t.workflow?.graph?.nodes??[]).filter(d=>d.type==="governedDocument"&&d.production==="template"),i=[...new Set(r.flatMap(d=>{let c=Er(d);return c===null?[]:[c]}))];if(i.length===0)return{rows:[],issues:[]};let o=new Map((await e.query(x.workflow.getTemplateStamps,{client:n,keys:i})).map(d=>[d.key,d])),a=[],l=[];for(let d of r){let c=Er(d);if(c===null)continue;let u=o.get(c);if(u===void 0)throw new Error(`offer: the environment answered nothing for template ${c}`);if(KM(d,u.parameters),u.parameters!==null){a.push({target:`stamp:${String(d.id)}`,detail:`template:${c} (${u.parameters.fields.length} Parameter)`});continue}l.push({severity:"error",area:"workflow",message:u.exists?`[governedDocument/templateWithoutParameters] Knoten "${String(d.id)}": die Vorlage ${c} deklariert keine Parameter (plexus-cli catalog apply, documentTemplates[].parameters).`:`[governedDocument/unknownTemplate] Knoten "${String(d.id)}": eine Vorlage ${c} gibt es in dieser Umgebung nicht.`})}return{rows:a,issues:l}}s(vS,"stampTemplatePins");async function XK(e,n,t){let r=qe(t),i=await bS(e,n,r),o=await vS(e,n,r),a=[...i.rows,...o.rows],l=[...i.issues,...o.issues];if(l.length>0)return{rows:a,refused:l,open:[]};if(a.length===0)throw new Error("offer workflow restamp-pins: the bundle pins no contract generator or package (offer workflow node set-generator) and fills no Word template");Ct(r);let d=a.map(p=>p.target.slice(6)),c=s(p=>d.some(h=>p.includes(`nodes.${h}.`)||p.includes(`node.${h}.`)||p.includes(`"${h}"`)),"onStamped"),u=Ft(r).filter(p=>p.severity==="error"&&c(p.message));return{rows:a,refused:[],open:u}}s(XK,"restampPinsOnDisk");var nX=Y.join("contract","resolver-setup.json"),Oi="resolver setup",rl=s((e,n)=>jn(e,n,Oi),"record"),ko=s((e,n)=>We(e,n,Oi),"text");function tX(e,n){let t=rl(e,"Datei"),r=rl(t.contractTemplate,"contractTemplate"),i=rl(t.resolver,"resolver");return{dir:n,contractTemplate:{key:ko(r.key,"contractTemplate.key"),name:xt(r.name,"contractTemplate.name",Oi,"Vorlagennamen"),file:ko(r.file,"contractTemplate.file"),role:ko(r.role,"contractTemplate.role")},revenueAccounts:Gm(t.revenueAccounts,Oi),billingItems:zm(t.billingItems,Oi),resolver:{key:ko(i.key,"resolver.key"),name:xt(i.name,"resolver.name",Oi,"Generatornamen"),description:i.description===void 0?null:xt(i.description,"resolver.description",Oi,"Beschreibungen"),legalText:i.legalText??{},source:ko(i.source,"resolver.source"),feeGroups:(i.feeGroups===void 0?[]:Ut(i.feeGroups,"resolver.feeGroups",Oi)).map((o,a)=>{let l=rl(o,`resolver.feeGroups[${a}]`);return{key:ko(l.key,"feeGroup.key"),name:xt(l.name,"feeGroup.name",Oi,"Geb\xFChrengruppen"),billingItemKeys:xS(l.billingItemKeys,"feeGroup.billingItemKeys")}}),billingItemKeys:xS(i.billingItemKeys??[],"resolver.billingItemKeys"),grantTemplateKeys:xS(i.grantTemplateKeys??[],"resolver.grantTemplateKeys"),scenarios:rX(i.scenarios??[]),config:rl(i.config,"resolver.config")}}}s(tX,"parseResolverSetup");function xS(e,n){if(!Array.isArray(e)||e.some(t=>typeof t!="string"||t.trim()==="")||new Set(e).size!==e.length)throw new Error(`generator setup: ${n} must be a list of unique keys.`);return e}s(xS,"stringList");function rX(e){if(!Array.isArray(e)||e.length>20)throw new Error("generator setup: scenarios must be a list of at most 20 reviewed examples.");return e.map(n=>{let t=rl(n,"scenario");if(!("input"in t)||!("expected"in t))throw new Error("generator setup: each scenario needs input and reviewed expected output.");return{key:ko(t.key,"scenario.key"),input:t.input,expected:t.expected}})}s(rX,"parseScenarios");function ng(e){let n=Y.resolve(e);return tX(JSON.parse(he(n,"utf8")),Y.dirname(n))}s(ng,"readResolverSetup");function iX(e,n){let t=e;for(let r of n.split(".")){if(typeof t!="object"||t===null||!(r in t))throw new Error(`resolver setup: resolver.config.${n} existiert nicht.`);t=t[r]}return t}s(iX,"configValue");function ej(e){let n=s(()=>ko(e.resolver.config.lehrgangsbeginn,"resolver.config.lehrgangsbeginn"),"effectiveFrom"),t=new Set(e.billingItems.map(r=>r.key));return{revenueAccounts:e.revenueAccounts,catalogItemKeys:[...new Set([...SS(e.resolver.config),...e.resolver.billingItemKeys])].filter(r=>!t.has(r)),billingItems:e.billingItems.map(r=>{if(r.programs!==void 0)throw new Error(`resolver setup: Artikel ${r.key}: "programs" verwaltet nur die Katalog-Datei (plexus-cli catalog), nicht resolver-setup.json.`);if("tree"in r.price)throw new Error(`resolver setup: Artikel ${r.key}: Tarife werden im Katalog verwaltet.`);let i=r.price.amount,o=typeof i=="object"&&i!==null&&typeof i.$config=="string"?iX(e.resolver.config,i.$config):i;if(typeof o!="number"||!Number.isFinite(o))throw new Error(`resolver setup: Artikel ${r.key}: Preis ist keine Zahl (${JSON.stringify(i)}).`);return{key:r.key,name:r.name,itemType:r.itemType,revenueAccountCode:r.revenueAccount,taxTreatment:r.taxTreatment,config:r.config,price:{amount:o,currency:r.price.currency,effectiveFrom:n(),period:r.price.period}}})}}s(ej,"billingSetupPayload");function nj(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let n=Object.entries(e);if(n.length!==1||n[0][0]!=="$billingItem")return;let t=n[0][1];if(typeof t!="string")throw new Error(`resolver setup: $billingItem ${JSON.stringify(t)} ist kein Schl\xFCssel.`);return t}s(nj,"billingItemRef");function SS(e){if(Array.isArray(e))return e.flatMap(SS);if(typeof e!="object"||e===null)return[];let n=nj(e);return n!==void 0?[n]:Object.values(e).flatMap(SS)}s(SS,"billingItemRefs");function AS(e,n,t={}){let r=s(i=>{if(Array.isArray(i))return i.map(r);if(typeof i=="object"&&i!==null){let o=Object.entries(i);if(o.length===1&&o[0][0]==="$grantTemplate"){let l=o[0][1];if(typeof l!="string"||t[l]===void 0)throw new Error(`generator setup: grant template ${String(l)} is not declared.`);return t[l]}let a=nj(i);if(a!==void 0){if(!(a in n))throw new Error(`resolver setup: $billingItem "${a}" ist weder in billingItems deklariert noch ein Katalogartikel.`);return n[a]}return Object.fromEntries(Object.entries(i).map(([l,d])=>[l,r(d)]))}return i},"walk");return r(e)}s(AS,"renderResolverConfig");function oX(e,n){let t=Array.isArray(e.documentPlaceholderKeys)?e.documentPlaceholderKeys:[],r=new Set(n.placeholders),i=new Set(t.map(String)),o=[...r].filter(l=>!i.has(l)),a=[...i].filter(l=>!r.has(l));if(o.length>0||a.length>0)throw new Error("resolver setup: resolver.config.documentPlaceholderKeys weicht vom DOCX ab"+(o.length>0?` \u2014 fehlt: ${o.join(", ")}`:"")+(a.length>0?` \u2014 nicht im DOCX: ${a.join(", ")}`:"")+". Liste aus dem DOCX \xFCbernehmen.")}s(oX,"assertPlaceholderParity");function sX(e,n){let t=[...e].filter(r=>r.status==="sealed").sort((r,i)=>i.versionNumber-r.versionNumber)[0];if(t!==void 0)return t.coverLetter===void 0&&t.source===n.source&&t.pinnedDocumentTemplateId===n.documentTemplateId&&Pe(t.config)===Pe(n.config)&&Pe(t.legalText)===Pe(n.legalText)&&Pe([...t.billingItemDefinitionIds].sort())===Pe([...n.billingItemDefinitionIds].sort())&&Pe([...t.grantTemplateIds].sort())===Pe([...n.grantTemplateIds].sort())&&Pe(t.feeGroups)===Pe(n.feeGroups)?t:void 0}s(sX,"matchingSealedRevision");async function bc(e,n,t){if(t.resolver.source===null)throw new Error("generator setup requires a self-contained source file.");let r=he(Y.join(t.dir,t.resolver.source),"utf8"),i=await Od(Y.join(t.dir,t.contractTemplate.file));oX(t.resolver.config,i);let o=await e.query(x.contractSetup.planBillingSetup,{client:n,...ej(t)}),a=await e.query(x.contractSetup.wordTemplateState,{client:n,configKey:t.contractTemplate.key}),l=a===null||a.sha256!==i.sha256,d=await e.query(x.contractConfig.model,{client:n}),c={};for(let E of t.resolver.grantTemplateKeys){let $=d.grantTemplates.find(C=>C.configKey===E);if($===void 0)throw new Error(`Unknown grant template ${E}`);c[E]=$.id}let u=AS(t.resolver.config,o.billingItemIds,c),h=(await e.query(x.contractGeneratorVersions.model,{client:n})).find(E=>E.definition.key===t.resolver.key),y=h?.currentRevisionId?await e.query(x.contractGeneratorVersions.detail,{client:n,id:h.currentRevisionId}):null,k=h?.revisions.find(E=>E.status==="draft"),w=k?await e.query(x.contractGeneratorVersions.detail,{client:n,id:k.id}):null,b=l||y===null?void 0:sX([y],{source:r,config:u,legalText:t.resolver.legalText,documentTemplateId:a.id,billingItemDefinitionIds:t.resolver.billingItemKeys.map(E=>o.billingItemIds[E]??`not-created:${E}`),grantTemplateIds:Object.values(c),feeGroups:t.resolver.feeGroups.map(E=>({key:E.key,name:E.name,billingItemDefinitionIds:E.billingItemKeys.map($=>o.billingItemIds[$]??`not-created:${$}`)}))}),T=o.rows.map(E=>({step:E.kind,target:E.key,action:E.action,detail:E.detail}));return T.push({step:"wordTemplate",target:t.contractTemplate.key,action:l?"create":"same",detail:Y.basename(i.file)}),T.push({step:"generatorVersion",target:t.resolver.key,action:b?"same":"create",detail:b?`Current sealed revision ${b.versionNumber}`:"Save source, review scenarios and seal a new revision"}),{rows:T,docx:i,source:r,renderedConfig:u,billingItemIds:o.billingItemIds,grantTemplateIds:c,head:h,current:y,draft:w,match:b,template:{documentTemplateId:a?.id??null,upload:l}}}s(bc,"planResolverSetup");async function tj(e,n,t){let r=await bc(e,n,t);if(r.rows.every(p=>p.action==="same"))return{rows:r.rows,pin:{key:t.resolver.key,kind:"generator"}};if(!r.match&&t.resolver.scenarios.length===0)throw new Error("A new generator revision requires reviewed scenarios.");let i=await e.mutation(x.contractSetup.applyBillingSetup,{client:n,...ej(t)});if(r.match)return{rows:r.rows,pin:{key:t.resolver.key,kind:"generator"}};let o=r.template.upload?await Um(e,n,r.docx,{name:t.contractTemplate.name,role:t.contractTemplate.role,configKey:t.contractTemplate.key}):r.template.documentTemplateId,a=r.draft?._id;if(a===void 0)if(r.head===void 0)a=(await e.mutation(x.contractGeneratorVersions.create,{client:n,key:t.resolver.key,name:t.resolver.name,description:t.resolver.description??{de:"",en:""}})).revisionId;else{if(r.current===null)throw new Error("Generator has neither draft nor sealed revision.");a=await e.mutation(x.contractGeneratorVersions.cloneDraft,{client:n,id:r.current._id})}let l=await e.query(x.contractGeneratorVersions.detail,{client:n,id:a}),d=await e.mutation(x.contractGeneratorVersions.save,{client:n,id:a,expectedSourceRevision:l.sourceRevision,config:AS(t.resolver.config,i.billingItemIds,r.grantTemplateIds),legalText:t.resolver.legalText,documentTemplateId:o}),c=await e.action(x.contractGeneratorVersionActions.saveSource,{client:n,id:a,expectedSourceRevision:d,source:r.source,billingItemDefinitionIds:t.resolver.billingItemKeys.map(p=>i.billingItemIds[p]),grantTemplateIds:Object.values(r.grantTemplateIds),feeGroups:t.resolver.feeGroups.map(p=>({key:p.key,name:p.name,billingItemDefinitionIds:p.billingItemKeys.map(h=>i.billingItemIds[h])}))});if(c.diagnostics.length||c.sourceRevision===null||c.artifactHash===null)throw new Error(c.diagnostics.join(`
|
|
11685
11685
|
`));if(d=c.sourceRevision,await e.mutation(x.contractGeneratorVersions.approveScenarios,{client:n,id:a,expectedSourceRevision:d,artifactHash:c.artifactHash,scenarios:AS({scenarios:t.resolver.scenarios},i.billingItemIds,r.grantTemplateIds).scenarios}),await e.mutation(x.contractGeneratorVersions.seal,{client:n,id:a,expectedSourceRevision:d}),(await bc(e,n,t)).match===void 0)throw new Error("The sealed revision does not match the declarative setup.");return{rows:r.rows,pin:{key:t.resolver.key,kind:"generator"}}}s(tj,"applyResolverSetup");async function ES(e,n,t){let r=Y.join(t.dir,nX);if(!Ae(r)||t.workflow===void 0)return[];let i=ng(r);if((await bc(e,n,i)).match===void 0)throw new Error("Apply the generator setup before publishing the offer.");return[]}s(ES,"pinSetupRevisions");function aX(e){if(e.label===void 0)return;let n=e.label;if(typeof n!="object"||n===null||typeof n.de!="string"||typeof n.en!="string")throw new Error(`node "${e.id}": label ${JSON.stringify(e.label)} is not a { de, en } text`);return{de:n.de,en:n.en}}s(aX,"nodeText");function vc(e,n){let t=[],r=[],i=[],o={},a=n.progressEvents??[],l=aX(e);for(let d of a){let c=`${e.id}.${d}`,u=n.progressDefaults?.[d];if(u===void 0)throw new Error(`node "${e.id}" (${e.type}) emits progress-event "${d}", but its node spec declares no progress default for it`);let p=e.type==="decision"&&d==="released"&&l!==void 0,h=p?l:u.label,y=u.tone,k={id:c,label:h,tone:y,external:u.external};u.terminal&&(k.terminal=!0),t.push(k),r.push({match:{nodeId:e.id},event:d,bus:"process",state:c});let w=u.phase,b=lX(w,e.id),T=i.find(E=>E.id===b);if(T)T.states=[...T.states,c];else{let E={id:b,label:p?h:w.label,tone:y,states:[c]};w.track&&(E.track=w.track),w.defaultCollapsed&&(E.defaultCollapsed=!0),w.waitlist&&(E.waitlist=!0),i.push(E)}u.terminal&&(o[c]=u.terminal)}return{states:t,mappings:r,columns:i,terminalSemantics:o}}s(vc,"deriveProgressEntriesForNode");function tg(e){return Object.entries(e).filter(([,n])=>n.outcome==="approved").map(([n])=>n)}s(tg,"seatedTerminalStates");function lX(e,n){return e.scope==="global"?`col.${e.key}`:`${n}.${e.key}`}s(lX,"columnIdFor");function rj(e,n){let t=s(i=>(i.states??[]).some(o=>n.terminalStateIds.has(o)),"isTerminal"),r=s(i=>{let o=n.columnNodeId(i);return(o!==void 0?n.nodeOrder.get(o):void 0)??Number.POSITIVE_INFINITY},"topoOf");return e.map((i,o)=>({c:i,idx:o,term:t(i)?1:0,topo:r(i)})).sort((i,o)=>i.term-o.term||i.topo-o.topo||i.idx-o.idx).map(i=>i.c)}s(rj,"orderProcessColumns");var mr=s((e,n)=>({de:e,en:n}),"lt"),RS=Ys("start",[]),rg=Ys("form",[RS]),TS=Ys("end",[RS,rg]);function dX(e){let n=[vc({id:rg,type:"form",label:mr("Formular","Form")},ys.form),vc({id:TS,type:"end",label:mr("Ende","End")},ys.end)],t=[],r=[],i=[],o={};for(let c of n){t.push(...c.states),i.push(...c.mappings),o={...o,...c.terminalSemantics};for(let u of c.columns){let p=r.find(h=>h.id===u.id);p?p.states=[...new Set([...p.states,...u.states])]:r.push(u)}}let a=tg(o);return{layout:{id:`layout.${e}.starter`,buses:[{key:"process",states:t,terminalSemantics:o,holdsSeat:a,commitsSeat:a,boards:[{id:"prozess",label:mr("Prozess","Process"),audience:"both",columns:r}]}]},wiring:{mappings:i}}}s(dX,"buildStarterProgress");function ij(e){let{slug:n,title:t,tenant:r,unit:i,responsible:o}=e,a=n,l=`${n}-form`,d=`${n}-flow`,c=[{id:RS,type:"eventTrigger",label:mr("Start","Start"),sublabel:mr("Eingang externer Bewerber-Aktion","Incoming external applicant action"),next:{bewerbungOffen:{to:rg}}},{id:rg,type:"form",label:t,sublabel:mr("Bewerbungsformular","Application form"),inputs:{smartForm:{kind:"literal",value:l}},outcomes:[{id:"standard",label:mr("Standard","Standard")}],next:{standard:{to:TS}},notifications:{submitted:{templateId:"applicant.applicationSubmitted"}}},{id:TS,type:"end",label:mr("Ende \xB7 Angenommen","End \xB7 Accepted"),inputs:{applicationOutcome:{kind:"literal",value:"approved"},dataDecision:{kind:"literal",value:"commit"}}}],u={nodes:c,assignmentRules:fC(mC([{slot:"responsible",rules:[{when:lo,assign:{kind:"creator"}},{when:null,assign:{kind:"person",configKey:o}}]}],um({nodes:c})))},{layout:p,wiring:h}=dX(d),y={id:nl("section.applicant"),label:mr("Antragsteller","Applicant"),fields:[{key:pt("applicant.vorname"),label:mr("Vorname","First name"),kind:"control",type:"string",required:!0,bucket:"applicant"},{key:pt("applicant.nachname"),label:mr("Nachname","Last name"),kind:"control",type:"string",required:!0,bucket:"applicant"}]},k=[{id:yo("standard"),label:mr("Standard","Standard"),when:"true",output:{fields:[{path:pt("applicant.vorname")},{path:pt("applicant.nachname")}],includeForm:!0}}],w={sections:[y],effects:[],outcomes:k},b={};return{index:{module:"admission",tenant:r,label:t,slugs:{manifest:a,workflow:a},smartforms:{[l]:{}},...i?{links:{unitKey:i}}:{}},manifest:b,smartforms:{[l]:{label:t,...w}},workflow:{graph:u,progressLayout:p,progressWiring:h}}}s(ij,"buildSkeletonBundle");var vs={same:"\xB7",create:"+",change:"~",absent:"\u2205"};async function Vn(e,n,t){let i=(await e.query(x.workflow.listManifests,{client:n})).find(o=>o.offerKey===t);if(!i)throw new je(`offer: no offer "${t}" in tenant "${n}"`);return i}s(Vn,"findOfferHandle");function mt(e,n,t){return e.query(x.programAdmin.getAngebotConfig,{client:n,offerKey:t,includeArchived:!0})}s(mt,"loadConfig");function $S(e,n){let t=e.units.find(r=>r.key===n);if(!t)throw new je(`offer: unit "${n}" not found. Available keys: ${e.units.map(r=>r.key??"(no key)").join(", ")||"(none)"}`);return t.unitId}s($S,"resolveUnitId");function il(e,n){let t=oj(e),r=e.runs.find(i=>i.key===nr(t,n));if(!r)throw new je(`offer: run "${n}" not found. Available keys: ${e.runs.map(i=>kO(t,i.key)).join(", ")||"(none)"}`);return r.runId}s(il,"resolveRunId");function ol(e,n){let t=oj(e),r=e.stages.find(i=>i.key===Ws(t,n));if(!r)throw new je(`offer: level "${n}" not found. Available keys: ${e.stages.map(i=>Jr(t,i.key)).join(", ")||"(none)"}`);return r.stageId}s(ol,"resolveStageId");function oj(e){if(e.programKey===null)throw new je("offer: the offer has no program yet \u2014 link a unit first");return e.programKey}s(oj,"requireProgramKey");async function IS(e,n,t,r){await e.mutation(x.programAdmin.ensurePedagogyUnit,{client:n,unitId:r}),await e.mutation(x.programAdmin.createProgramForAngebot,{client:n,offerKey:t,unitId:r})}s(IS,"linkUnit");function xs(e,n){if(n===void 0)return;let t=Number(n);if(!Number.isInteger(t)||t<0)throw new Error(`offer: --${e} must be a non-negative integer`);return t}s(xs,"parsePositiveInt");var sl=s((e="Offer slug (required)")=>f.String("--offer",{description:e}),"offerOption"),OS=s(()=>f.String("--slug",{hidden:!0}),"retiredSlugOption");function _S(e){if(e.retiredSlug!==void 0){if(e.offer!==void 0&&e.offer!==e.retiredSlug)throw new xn(`--offer "${e.offer}" and --slug "${e.retiredSlug}" name different offers \u2014 pass only --offer.`);return ln(e.context.stderr,"--slug","--offer"),e.retiredSlug}if(e.offer===void 0)throw new xn("Missing --offer <slug>.");return e.offer}s(_S,"requireOffer");var tn=class extends N{static{s(this,"OfferCommand")}offer=sl();retiredSlug=OS();#e;get offerSlug(){return this.#e??=_S(this),this.#e}};var xc=class extends tn{static{s(this,"OfferExportCommand")}static paths=[["offer","export"]];static usage=R.Usage({category:"Offer",description:"Pull an offer's published generation (manifest + smartforms + workflow + program) into a bundle; --draft pulls the draft"});offer=sl("Manifest slug to export (required)");out=f.String("--out",{required:!0,description:"Output bundle directory (refused when not empty, unless --force)"});force=bn();draft=f.Boolean("--draft",!1,{description:"Export the editable draft instead of the published generation (the live head, else the staged candidate)"});async execute(){let n=Tb(this.out,this.force),t=await this.caller(),r=this.requireTenant(t),{bundle:i,generation:o,revision:a}=await Fq(t,r,this.offerSlug,this.draft?"draft":"published");return Ct({...i,dir:n}),this.print({exported:`${r}/${this.offerSlug}`,generation:o,revision:a,dir:n},l=>[{key:"exported",value:l.exported},{key:"generation",value:`${l.generation} (revision ${l.revision})`},{key:"dir",value:l.dir}]),0}},Sc=class extends xe{static{s(this,"OfferInitCommand")}static paths=[["offer","init"]];static usage=R.Usage({category:"Offer",description:"Scaffold a complete, publishable, minimal linear offer bundle on disk"});offer=sl("New offer slug (identity key) (required)");retiredSlug=OS();title=f.String("--title",{required:!0,description:"Bare offer title in German (= program/form label), e.g. 'Grundschule'. Do NOT include the run/year or levels \u2014 those are separate entities (program_runs.name / program_stages) shown alongside the offer, never composed into the label."});titleEn=f.String("--title-en",{required:!0,description:"The same title in English, e.g. 'Primary School' (every name a reader sees has both)"});tenant=f.String("--tenant",{required:!0,description:"Tenant slug (stamped on bundle.yaml)"});unit=f.String("--unit",{description:"Pedagogic unit (school) the portal resolves the offer through \u2014 its config key"});responsible=f.String("--responsible",{required:!0,description:"configKey of the staff member a self-service application goes to (the process slot\u2019s \u201Esonst\u201C row); a staff start goes to its creator"});template=f.String("--template","basic",{description:"Scaffold template (only 'basic')"});out=f.String("--out",{description:"Output directory (default: offers/<tenant>/<slug>; refused when not empty, unless --force)"});force=bn();async execute(){let n=_S(this);if(this.template!=="basic")throw new Error(`offer init: unknown template "${this.template}" (only 'basic')`);let t=Tb(this.out??Y.join("offers",this.tenant,n),this.force),r=ij({slug:n,title:nt({de:this.title,en:this.titleEn},"offer init",{de:"--title",en:"--title-en"}),tenant:this.tenant,responsible:this.responsible,template:"basic",...this.unit?{unit:this.unit}:{}});return Ct({...r,dir:t}),this.print({created:`${this.tenant}/${n}`,dir:t},i=>[{key:"created",value:i.created},{key:"dir",value:i.dir},{key:"next",value:`plexus offer validate --dir ${i.dir}`}]),0}},Ac=class extends xe{static{s(this,"OfferValidateCommand")}static paths=[["offer","validate"]];static usage=R.Usage({category:"Offer",description:"Run the publish-gate validators locally against a bundle (no deployment)"});dir=f.String("--dir",{required:!0,description:"Bundle directory"});async execute(){let n=qe(this.dir),t=Ft(n);return this.print(t,r=>r.length===0?[{severity:"ok",area:"-",message:"local validation clean"}]:r.map(i=>({severity:i.severity,area:i.area,message:i.message}))),t.some(r=>r.severity==="error")?1:0}},Ec=class extends N{static{s(this,"OfferPlanCommand")}static paths=[["offer","plan"]];static usage=R.Usage({category:"Offer",description:"Read-only: local validation (resolver pins stamped from the environment, as publish would) + remote\u2194local diff (create/change/same)"});dir=f.String("--dir",{required:!0,description:"Bundle directory"});async execute(){let n=qe(this.dir),t=await this.caller(),{pins:r,stamps:i,issues:o}=await sj(t,n),a=await cS(t,n);return this.print({validation:o,resolverPins:r,resolverStamps:i.rows,diff:a},()=>[...o.map(l=>({kind:`local:${l.severity}`,target:l.area,detail:l.message})),...r.map(l=>({kind:"=",target:l.target,detail:l.detail})),...i.rows.map(l=>({kind:"=",target:l.target,detail:l.detail})),{kind:vs[a.manifest],target:"manifest",detail:a.manifest},...Object.entries(a.smartforms).map(([l,d])=>({kind:vs[d],target:`smartform:${l}`,detail:d})),{kind:vs[a.workflow],target:"workflow",detail:a.workflow},...aj(a).map(l=>({kind:l.icon,target:l.target,detail:l.status})),...lj(a).map(l=>({kind:l.icon,target:l.target,detail:l.status})),...dj(a).map(l=>({kind:l.icon,target:l.target,detail:l.status})),...cj(a).map(l=>({kind:l.icon,target:l.target,detail:l.status}))]),o.some(l=>l.severity==="error")?1:0}},Tc=class extends N{static{s(this,"OfferDiffCommand")}static paths=[["offer","diff"]];static usage=R.Usage({category:"Offer",description:"Read-only remote\u2194local drift (no local validation)"});dir=f.String("--dir",{required:!0,description:"Bundle directory"});async execute(){let n=qe(this.dir),t=await this.caller(),r=await ES(t,n.index.tenant,n),i=await cS(t,n);return this.print(i,()=>[...r.map(o=>({icon:"=",target:o.target,status:o.detail})),{icon:vs[i.manifest],target:"manifest",status:i.manifest},...Object.entries(i.smartforms).map(([o,a])=>({icon:vs[a],target:`smartform:${o}`,status:a})),{icon:vs[i.workflow],target:"workflow",status:i.workflow},...aj(i),...lj(i),...dj(i),...cj(i)]),0}};async function sj(e,n){let t=await ES(e,n.index.tenant,n),r=await bS(e,n.index.tenant,n),i=await vS(e,n.index.tenant,n);return{pins:t,stamps:{...r,rows:[...r.rows,...i.rows]},issues:[...r.issues,...i.issues,...Ft(n)]}}s(sj,"validateOnEnvironment");function aj(e){return e.addresses===null?[]:Nq(e.addresses)}s(aj,"addressRows");function lj(e){let n={insert:"+",update:"~",archive:"-"};return e.stages.map(t=>({icon:n[t.op],target:`stage:${t.key}`,status:ip(t)}))}s(lj,"stageRows");function dj(e){return e.capacities.map(n=>({icon:"~",target:`cap:${n.run}\xD7${n.stageKey}`,status:Sh(n)}))}s(dj,"capacityRows");function cj(e){if(e.publishPending===null)return[];let n=e.externalHeadRevision===null?"none":`v${e.externalHeadRevision}`;return[{icon:e.publishPending?"!":"=",target:"publish",status:e.publishPending?`pending (draft v${e.draftRevision} ahead of live ${n})`:`up to date (live ${n})`}]}s(cj,"publishPendingRows");var Rc=class extends N{static{s(this,"OfferApplyCommand")}static paths=[["offer","apply"]];static usage=R.Usage({category:"Offer",description:"Idempotent create/update; with --publish, release the draft when it differs from what is live"});dir=f.String("--dir",{required:!0,description:"Bundle directory"});publish=f.Boolean("--publish",!1,{description:"Release the draft when it says something the live generation does not"});stage=f.String("--stage","external",{description:"Publish stage: 'external' (default, goes live) or 'internal' (stage as the testable candidate only)"});async execute(){if(this.stage!=="internal"&&this.stage!=="external")throw new Error(`offer: --stage must be 'internal' or 'external' (got "${this.stage}")`);let n=qe(this.dir),t=await this.caller(),{pins:r,stamps:i,issues:o}=await sj(t,n);for(let d of[...r,...i.rows])this.context.stderr.write(` = ${d.target}: ${d.detail}
|
|
@@ -11862,6 +11862,6 @@ ${t.length} unusable ${o}:
|
|
|
11862
11862
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11863
11863
|
`),i.length>0&&this.context.stdout.write(` ${i.length} without any login account \u2014 plexus-cli platform users provision --tenant <slug> --email <email> --name <name>
|
|
11864
11864
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11865
|
-
`);return t.length>0?1:0}},xR=class extends kr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=R.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function GU(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(GU,"requireOnOff");var zU=[oR,sR,aR,lR,dR,cR,uR,fR,pR,mR,ju,hR,gR,yR,wR,kR,bR,vR,xR];function WU(e){return e.de??e.en??Object.values(e)[0]??""}s(WU,"titleDe");function Nee(e){return{id:e._id,kind:e.kind,status:e.status,title:WU(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(Nee,"row");var Cee=["id","kind","status","title","assignee","group","outcome"],ER=class extends N{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=R.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(Nee),Cee),0}},TR=class extends N{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=R.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:WU(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},RR=class extends N{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=R.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},$R=class extends N{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=R.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},IR=class extends N{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=R.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},YU=[ER,TR,RR,$R,IR];var Vu=[...gO,...WF,...tL,...a0,...u0,...s0,...L0,...U0,...B0,...BU,...zU,...VU,...RB,...NB,..._F,...N0,...OU,...mO,...WO,...gF,...W0,...z0,...J0,...Q0,..._0,...y0,...YU,...kj,...lV,...EB,...dV,...pU,...vU,...CB,...BB,...zB,...JB,...ZB,...AU,...DU,...LO];for(let e of Vu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:O$(e.usage.category,n.join(" "))})}var HU="0.1.285";function JU(){return Vu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=T$[Oo(t)];return{path:t,effect:_o(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(JU,"plexusCommandCatalog");import Ts from"node:path";function Dee(e){let n=cn()?.workspaceRoot??process.cwd(),t=Ts.resolve(n,e),r=Ts.relative(n,t);if(Ts.isAbsolute(e)||r===".."||r.startsWith(`..${Ts.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(Dee,"workspacePath");function Fee(e){let{absolute:n,relative:t}=Dee(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Kr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Ts.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ts.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return Ye(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Bn(Ts.dirname(n),{recursive:!0}),Ye(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Os(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(Fee,"plexusWorkspace");function QU(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Bl[t];if(!o||!Object.hasOwn(Bl,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(iw,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:iw[i.path],skillHash:Xf}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return Fee(i)},"executePlexusAgentTool")}s(QU,"createPlexusAgentToolExecutor");var jg=QU({inspectCommand:XU,executeCommand:eG});function Vg(){let e=new Cs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:HU});e.register(Al.HelpCommand),e.register(Al.VersionCommand);for(let t of Vu)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return qee(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(Vg,"createPlexusCli");function qee(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&$l[t]===r&&ln(n,t,r),t in $l&&_o(t)==="confirm"&&!Il(e)&&n.write(`plexus-cli: \`${$l[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11865
|
+
`);return t.length>0?1:0}},xR=class extends kr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=R.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function GU(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(GU,"requireOnOff");var zU=[oR,sR,aR,lR,dR,cR,uR,fR,pR,mR,ju,hR,gR,yR,wR,kR,bR,vR,xR];function WU(e){return e.de??e.en??Object.values(e)[0]??""}s(WU,"titleDe");function Nee(e){return{id:e._id,kind:e.kind,status:e.status,title:WU(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(Nee,"row");var Cee=["id","kind","status","title","assignee","group","outcome"],ER=class extends N{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=R.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(Nee),Cee),0}},TR=class extends N{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=R.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:WU(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},RR=class extends N{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=R.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},$R=class extends N{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=R.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},IR=class extends N{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=R.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},YU=[ER,TR,RR,$R,IR];var Vu=[...gO,...WF,...tL,...a0,...u0,...s0,...L0,...U0,...B0,...BU,...zU,...VU,...RB,...NB,..._F,...N0,...OU,...mO,...WO,...gF,...W0,...z0,...J0,...Q0,..._0,...y0,...YU,...kj,...lV,...EB,...dV,...pU,...vU,...CB,...BB,...zB,...JB,...ZB,...AU,...DU,...LO];for(let e of Vu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:O$(e.usage.category,n.join(" "))})}var HU="0.1.287";function JU(){return Vu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=T$[Oo(t)];return{path:t,effect:_o(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(JU,"plexusCommandCatalog");import Ts from"node:path";function Dee(e){let n=cn()?.workspaceRoot??process.cwd(),t=Ts.resolve(n,e),r=Ts.relative(n,t);if(Ts.isAbsolute(e)||r===".."||r.startsWith(`..${Ts.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(Dee,"workspacePath");function Fee(e){let{absolute:n,relative:t}=Dee(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Kr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Ts.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ts.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return Ye(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Bn(Ts.dirname(n),{recursive:!0}),Ye(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Os(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(Fee,"plexusWorkspace");function QU(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Bl[t];if(!o||!Object.hasOwn(Bl,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(iw,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:iw[i.path],skillHash:Xf}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return Fee(i)},"executePlexusAgentTool")}s(QU,"createPlexusAgentToolExecutor");var jg=QU({inspectCommand:XU,executeCommand:eG});function Vg(){let e=new Cs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:HU});e.register(Al.HelpCommand),e.register(Al.VersionCommand);for(let t of Vu)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return qee(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(Vg,"createPlexusCli");function qee(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&$l[t]===r&&ln(n,t,r),t in $l&&_o(t)==="confirm"&&!Il(e)&&n.write(`plexus-cli: \`${$l[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11866
11866
|
`)}s(qee,"noteRetiredPath");function XU(e){let n=Vg().process(hl(e),{executePlexusAgentTool:jg}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=JU().find(l=>l.path===t);if(!r){if(t===""||t==="--help"||t==="--version")return{path:t,writes:!1,host:"shared"};throw new Error(`plexus: command ${t} has no host classification.`)}let i=n,o=r.effect==="callKind"?hh(Ha(Ja),i.fn??"",i.kind):void 0,a=Sf(t,{confirm:Il(n),callKind:o});return{...r,writes:a}}s(XU,"inspectPlexusCommand");async function eG(e,n){if(n)return _R(n,()=>eG(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let t="",r="",i=Vg();if(cn()){let l=XU(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(hl(e.argv),{executePlexusAgentTool:jg,stdin:Mee.from(e.stdin===void 0?[]:[e.stdin]),stdout:new ZU({write(l,d,c){t+=String(l),c()}}),stderr:new ZU({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(eG,"executePlexusCommand");FR({source:Kee.join(import.meta.dirname,"skill")});Vg().runExit(hl(process.argv.slice(2)),{executePlexusAgentTool:jg});
|
|
11867
11867
|
//# sourceMappingURL=cli.mjs.map
|